Skip to content

Commit

Permalink
Lint only staged files in pre-commit hook
Browse files Browse the repository at this point in the history
  • Loading branch information
firefoxic committed Aug 25, 2024
1 parent 82a1484 commit ee1df66
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion .git-hooks/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,8 @@ git stash -ku

trap "git stash pop" EXIT

pnpm test
staged=$(git --no-pager diff --staged --name-only | grep -E '\.js$')

if [ -n "$staged" ]; then
pnpm exec eslint `echo $staged` && node --test
fi

0 comments on commit ee1df66

Please sign in to comment.