Way of validating commited JavaScript files with JSHint.
Note that JSHint will validate files within the current commit only - this is made on purpose and this is the only reason why the repo was created.
Shell script is a modification of this SH from StackOverflow with better formatted output.
- Make sure you have Git and Node.js installed
$ git clone git@github.com:sbedulin/jshint-pre-commit-hook.git
$ cd jshint-pre-commit-hook
$ npm install
$ grunt jshint-hook
- this task will copy.jshint-pre-commit-hook
file to.git\hooks
folder- Create some valid/invalid JavaScript files and try to commit them
- JSHint rules are listed in
.jshintrc
- JSHint ignores are listed in
.jshintignore
This is how sample validation output looks in the console:
WebStorm
and TurtoiseGit