-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat/configure husky and lintstaged #492
base: main
Are you sure you want to change the base?
Changes from all commits
f4aaf78
6330337
aea2ada
e5add1b
dea7a23
9f44b2d
5d926b0
2d91030
ca9c45f
989feda
fa047e5
adaa3e2
976ba34
87e8a92
3210e3d
5f37153
9f3ddf2
43b1f24
1c42057
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
npx lint-staged | ||
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,7 @@ | ||||||||||||||||||||||||
{ | ||||||||||||||||||||||||
"*.tsx": ["eslint", "prettier --write"], | ||||||||||||||||||||||||
"*.ts": ["eslint", "prettier --write"], | ||||||||||||||||||||||||
"*.js": ["eslint", "prettier --write"], | ||||||||||||||||||||||||
"*.jsx": ["eslint", "prettier --write"] | ||||||||||||||||||||||||
} | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
Comment on lines
+1
to
+7
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Optimize configuration and expand coverage. The current configuration can be simplified and enhanced:
Apply this diff to optimize the configuration: {
- "*.tsx": ["eslint", "prettier --write"],
- "*.ts": ["eslint", "prettier --write"],
- "*.js": ["eslint", "prettier --write"],
- "*.jsx": ["eslint", "prettier --write"]
+ "*.{js,jsx,ts,tsx}": ["eslint", "prettier --write"],
+ "*.{json,md,yml,yaml}": ["prettier --write"]
}
- 📝 Committable suggestion
Suggested change
💡 Codebase verification Inconsistent lint-staged configurations detected The root
This inconsistency should be resolved by:
🔗 Analysis chainVerify consistent lint-staged configuration across the monorepo. There are different lint-staged configurations in the root and apps/commands directory. This might lead to inconsistent behavior. Run this script to check for configuration consistency: Let me try a different approach to find the lint-staged configurations, as they might be defined in package.json files as well. 🏁 Scripts executedThe following scripts were executed for the analysis: Script: #!/bin/bash
# Description: Check for lint-staged configurations across the monorepo
# and verify their consistency
echo "Finding all lint-staged configuration files:"
fd -e json -e js -e yaml -e yml --glob '*lintstagedrc*'
echo -e "\nComparing configurations for consistency:"
for config in $(fd -e json -e js -e yaml -e yml --glob '*lintstagedrc*'); do
echo -e "\n=== $config ==="
cat "$config"
done
Length of output: 314 Script: #!/bin/bash
# Search for lint-staged configurations in both dedicated config files and package.json
echo "Searching for dedicated lint-staged config files:"
fd -e json -e js -e yaml -e yml --glob '*lintstagedrc*'
echo -e "\nSearching for lint-staged configurations in package.json files:"
rg -l '"lint-staged"' -g 'package.json'
echo -e "\nContent of package.json files containing lint-staged config:"
for pkg in $(rg -l '"lint-staged"' -g 'package.json'); do
echo -e "\n=== $pkg ==="
cat "$pkg" | jq '.["lint-staged"]'
done
Length of output: 775 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"*.tsx": ["eslint", "prettier --write"], | ||
"*.ts": ["eslint", "prettier --write"], | ||
"*.js": ["eslint", "prettier --write"], | ||
"*.jsx": ["eslint", "prettier --write"] | ||
} |
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,3 @@ | ||||||||
{ | ||||||||
"*.tsx,*.jsx":["eslint", "prettier --write"] | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix JSON syntax and expand file type coverage. The current configuration has several issues:
Apply this diff to fix and enhance the configuration: - "*.tsx,*.jsx":["eslint", "prettier --write"]
+ "*.{tsx,jsx,ts}": ["eslint", "prettier --write"],
+ "*.{json,md,yml,yaml}": ["prettier --write"] 📝 Committable suggestion
Suggested change
|
||||||||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"*.tsx": ["eslint", "prettier --write"], | ||
"*.ts": ["eslint", "prettier --write"], | ||
"*.js": ["eslint", "prettier --write"], | ||
"*.jsx": ["eslint", "prettier --write"] | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,11 @@ | |
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"], | ||
"rules": { | ||
"@next/next/no-html-link-for-pages": ["error", "apps/frontend/pages"], | ||
"no-extra-boolean-cast": "off" | ||
"no-extra-boolean-cast": "off", | ||
"@typescript-eslint/no-unused-vars": [ | ||
"error", | ||
{ "caughtErrors": "all" } | ||
] | ||
Comment on lines
+15
to
+18
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Codebase verification Consider aligning with root configuration for unused vars The root ESLint configuration already has a more flexible "@typescript-eslint/no-unused-vars": ["error", { "argsIgnorePattern": "^_", "varsIgnorePattern": "^_" }]
🔗 Analysis chainConsider a less strict setting for caught errors While enabling Let's verify ESLint configuration consistency across the monorepo: 🏁 Scripts executedThe following scripts were executed for the analysis: Script: #!/bin/bash
# Check for ESLint configs and their no-unused-vars rules
fd -e json -e js --exec sh -c 'echo "=== {} ===" && cat {} | grep -A 5 "no-unused-vars"' .eslintrc
Length of output: 1776 Script: #!/bin/bash
# Search for ESLint config files and show their content
fd -e json -g '*eslint*' -x cat {}
Length of output: 38 Script: #!/bin/bash
# Try finding eslint configs using ripgrep
rg --type-add 'eslint:*.{json,js}' --type eslint -l "eslintConfig|\"rules\":|extends" .
Length of output: 1112 Script: #!/bin/bash
# Check content of all ESLint config files
for file in $(find . -name ".eslintrc.json"); do
echo "=== $file ==="
cat "$file"
echo -e "\n"
done
Length of output: 16187 |
||
} | ||
}, | ||
{ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"*.tsx": ["eslint", "prettier --write"], | ||
"*.ts": ["eslint", "prettier --write"], | ||
"*.js": ["eslint", "prettier --write"], | ||
"*.jsx": ["eslint", "prettier --write"] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"*.tsx": ["eslint", "prettier --write"], | ||
"*.ts": ["eslint", "prettier --write"], | ||
"*.js": ["eslint", "prettier --write"], | ||
"*.jsx": ["eslint", "prettier --write"] | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Add shell configuration and error handling to the pre-commit hook.
The pre-commit hook should include proper shell configuration for reliability.
Apply this diff to improve the hook's robustness:
📝 Committable suggestion