Skip to content

Instantly share code, notes, and snippets.

@attaboy
Last active July 25, 2016 14:45
Show Gist options
  • Save attaboy/bbdff945d98fe0ff79c90d1aac3fda9d to your computer and use it in GitHub Desktop.
Save attaboy/bbdff945d98fe0ff79c90d1aac3fda9d to your computer and use it in GitHub Desktop.
Run eslint on the pending git commit
#!/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