Skip to content

Instantly share code, notes, and snippets.

@enVolt
Last active February 9, 2017 13:50
Show Gist options
  • Save enVolt/d7baeb16dcb330c0a1e19d324c8f64f6 to your computer and use it in GitHub Desktop.
Save enVolt/d7baeb16dcb330c0a1e19d324c8f64f6 to your computer and use it in GitHub Desktop.
Pre-commit hook for Node.js Project
#! /bin/sh
npm run eslint
RESULT=$?
echo $RESULT
[ $RESULT -ne 0 ] && exit 1
npm test
RESULT=$?
[ $RESULT -ne 0 ] && exit 1
exit 0
@enVolt
Copy link
Author

enVolt commented Jun 24, 2016

File location <ProjectDirectory>/.git/hooks/pre-commit

Change file mod to executable (chmod +x ./.git/hooks/pre-commit)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment