Skip to content

Instantly share code, notes, and snippets.

@DannyDelott
Last active April 12, 2016 21:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DannyDelott/cf6e51c02eb660dab9d6a93dcbfdf75d to your computer and use it in GitHub Desktop.
Save DannyDelott/cf6e51c02eb660dab9d6a93dcbfdf75d to your computer and use it in GitHub Desktop.
Pre-commit hook
#!/bin/sh
for staged_file in $(git diff --cached --name-only)
do
if [[ "$staged_file" == *\.js$* ]] && [ -f "$staged_file" ]; then
./node_modules/jscs/bin/jscs "$staged_file"
if [[ "$?" != "0" ]]; then
exit 1
fi
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment