Skip to content

Instantly share code, notes, and snippets.

@porqz
Last active May 11, 2017 09:57
Show Gist options
  • Save porqz/73e27cdb69aa2359f99a to your computer and use it in GitHub Desktop.
Save porqz/73e27cdb69aa2359f99a to your computer and use it in GitHub Desktop.
ESLint commit hook shell script
#!/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