JSHint with Make17 Jan 2014
I talked about using make with node, but this is specific to the JSHint configuration/target for make.
This goes in the root of the directory alongside the Makefile.
This has the
expr relaxing options turned on because I'm that
kind of person. Also included are the globals for Mocha.
The default JSHint reporter is lacking. Mostly in the fact that, if the lint succeeds, there is not output, but also because it's just plain ugly and not too easy to read. Fortunately, our friend Sindre solved this problem with JSHint-Stylish which formats errors in a much better way and also lets you know when the lint succeeded.
The actual lint target in make
lint: $(SRC) @node_modules/.bin/jshint \ --reporter node_modules/jshint-stylish/stylish.js \ $^
This relies on all of the source files being declared in a variable named
SRC. I like to do this just to make sure that the target is clean and pretty.
You can use
$(wilcard dir/*.js) to ensure that all files in a directory are
included in the lint.
There is no need to specify the rc file because JSHint checks the current
working directory for a
.jshintrc to use.