For a project I am currently working on I wanted to lint my js files before everything gets built.
I usually abuse Komodo Edit to build it anytime on save by calling a simple macro that runs make.
But I was still using jshint inside Firefox and it really felt boring to prepend the same custom lint config on top of each new js file. Weeks ago I’ve seen a commit message in jquerys’ git repository mentioning a replacement of jslint in favor for jshint.
As they already integrated that tool it was pretty easy to extend their jshint make-target to my needs.
First of all I added a “dependencies.json”-file to my build directory - example content following:
To install jshint with npm I ran the following command inside that build directory:
[projectdir]$ npm install -d
I came up with the following js code - saved as jshint-check.js:
I documented some options - but you may be better off with the options page to customize that part.
My make test-target looks like this:
Remember to replace spaces with tabs (POSIX requires that) - I just used spaces for readability here.