Skip to content

Instantly share code, notes, and snippets.

@kiasaki
Last active August 29, 2015 14:18
Show Gist options
  • Save kiasaki/cb33a5f252f7e820aa28 to your computer and use it in GitHub Desktop.
Save kiasaki/cb33a5f252f7e820aa28 to your computer and use it in GitHub Desktop.
eslint pre-commit hook

To install:

curl -o .git/hooks/pre-commit http://git.io/jSry
chmod +x .git/hooks/pre-commit
#!/bin/sh
# Redirect output to stderr.
exec 1>&2
./node_modules/eslint/bin/eslint.js .
rc=$?
if [[ $rc != 0 ]]; then
echo "----
----> Error: Your code doesn't lint! Fix that before commiting.
----"
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment