Skip to content

Instantly share code, notes, and snippets.

@gianlucacandiotti
Forked from jhartikainen/commit-msg
Last active August 29, 2015 14:24
Show Gist options
  • Save gianlucacandiotti/10b137def16e678e399e to your computer and use it in GitHub Desktop.
Save gianlucacandiotti/10b137def16e678e399e to your computer and use it in GitHub Desktop.
#!/bin/bash
files=$(git diff --cached --name-only | grep '\.js$')
# Prevent ESLint help message if no files matched
if [[ $files = "" ]] ; then
exit 0
fi
echo $files | xargs eslint
rc=$?
if [[ $rc != 0 ]] ; then
echo "ESLint check failed, commit denied"
exit $rc
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment