mirror of
https://github.com/lingble/chatwoot.git
synced 2025-10-30 02:32:29 +00:00
chore: Run linters on staged files only (#6347)
- This PR speeds up the pre-commit hook to lint only the staged files instead of running it across all files as it does now.
This commit is contained in:
@@ -1,5 +1,11 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
. "$(dirname "$0")/_/husky.sh"
|
. "$(dirname "$0")/_/husky.sh"
|
||||||
npm run eslint
|
|
||||||
bundle exec rubocop -a
|
# lint js and vue files
|
||||||
git add
|
npx --no-install lint-staged
|
||||||
|
|
||||||
|
# lint only staged ruby files
|
||||||
|
git diff --name-only --cached | xargs ls -1 2>/dev/null | grep '\.rb$' | xargs bundle exec rubocop -a
|
||||||
|
|
||||||
|
# stage rubocop changes to files
|
||||||
|
git diff --name-only --cached | xargs git add
|
||||||
|
|||||||
@@ -122,7 +122,6 @@
|
|||||||
},
|
},
|
||||||
"husky": {
|
"husky": {
|
||||||
"hooks": {
|
"hooks": {
|
||||||
"pre-commit": "lint-staged",
|
|
||||||
"pre-push": "sh bin/validate_push"
|
"pre-push": "sh bin/validate_push"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -138,10 +137,6 @@
|
|||||||
"eslint --fix",
|
"eslint --fix",
|
||||||
"git add"
|
"git add"
|
||||||
],
|
],
|
||||||
"!(*schema).rb": [
|
|
||||||
"bundle exec rubocop -a",
|
|
||||||
"git add"
|
|
||||||
],
|
|
||||||
"*.scss": [
|
"*.scss": [
|
||||||
"scss-lint"
|
"scss-lint"
|
||||||
]
|
]
|
||||||
|
|||||||
Reference in New Issue
Block a user