Last active
June 24, 2017 15:51
-
-
Save constgen/383fbfa6ed8460b4da21d8c178e3f468 to your computer and use it in GitHub Desktop.
Git ESLint precommit hook
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
function lintit () { | |
OUTPUT=$(git diff --name-only | grep -E '(.js)$') | |
a=("${(f)OUTPUT}") | |
e=$(eslint -c eslint.json $a) | |
echo $e | |
if [[ "$e" != *"0 problems"* ]]; then | |
echo "ERROR: Check eslint hints." | |
exit 1 # reject | |
fi | |
} | |
lintit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment