Created
September 6, 2013 13:41
-
-
Save vilmosioo/6463953 to your computer and use it in GitHub Desktop.
Run grunt jshint before every commit. The commit fails if any warnings/errors are generated. Helps avoid "jshint fix" style commits
This file contains hidden or 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
#!/usr/bin/env node | |
var exec = require('child_process').exec; | |
// Runs the build task, in our case `grunt jshint` | |
exec('grunt jshint', function (error, stdout, stderr) { | |
// Build task output might be useful to the developer so let's print it | |
// We could also log it in a file | |
console.log(stdout); | |
// Depending on the result of the build, either print the error | |
// or exit successfully | |
var exitCode = 0; | |
if (error) { | |
console.log('Fix jshint errors before committing'); | |
console.log(stderr); | |
exitCode = -1; | |
} | |
process.exit(exitCode); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment