Files
leadchat/.husky/pre-commit
Shivam Mishra e1e836cb59 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.
2023-01-31 17:29:34 +05:30

12 lines
308 B
Bash
Executable File

#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
# lint js and vue files
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