Last active
July 25, 2016 14:45
-
-
Save attaboy/bbdff945d98fe0ff79c90d1aac3fda9d to your computer and use it in GitHub Desktop.
Run eslint on the pending git commit
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/sh | |
DIFF_FILES=$(git diff --cached --name-only|egrep app/assets/.+\.jsx?$) | |
if [ ! -z $DIFF_FILES ]; | |
then | |
./node_modules/.bin/eslint -- $DIFF_FILES | |
fi | |
if [ $? -eq 1 ]; | |
then | |
printf "Lint failed. Commit with --no-verify to continue or fix your errors\n\n"; | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment