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.
Ben Alpert committed
Sep 1, 2015 at 14:29 UTC
25fec05ab41521299311142ca0af64469f84fde1
1 file changed
+18
scripts/git/pre-commit
new
+18
@@ -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 --