Skip to content

Commit 25fec05

Browse files
committed
Add linting pre-commit hook
Anyone who wants it will have to do ``` ln -s scripts/git/pre-commit .git/hooks/pre-commit ``` or similar.
1 parent 0ff65cc commit 25fec05

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

scripts/git/pre-commit

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/sh
2+
#
3+
# To enable this hook, symlink or copy this file to .git/hooks/pre-commit.
4+
5+
if git rev-parse --verify HEAD >/dev/null 2>&1
6+
then
7+
against=HEAD
8+
else
9+
# Initial commit: diff against an empty tree object
10+
against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
11+
fi
12+
13+
# Redirect output to stderr.
14+
exec 1>&2
15+
16+
git diff --cached --name-only --diff-filter=ACMRTUB | \
17+
grep '\.js$' | \
18+
xargs ./node_modules/.bin/eslint --

0 commit comments

Comments
 (0)