On Nov 21, 2012, at 7:23 PM, S Page <spage(a)wikimedia.org> wrote:
I have vim set up [..]
That's great. If you're using a different editor, here's a list if all kinds
of platforms and editors and how to use jshint in them:
http://jshint.com/platforms/
On Nov 21, 2012, at 7:23 PM, S Page <spage(a)wikimedia.org> wrote:
Should we be using .jshintrc per directory or lines
like
/*jshint multistr:true */
at the top of files? Or both?
Neither. Place .jshintrc in the root directory of the repository. JSHint travels up until
it finds it. Falling back ~/.jshintrc in your home directory (e.g. for files not in a
repository but just loose somewhere, opening them up in your editor would use that).
Although having it in your editor is nice, but for massive (recursive) running against a
repository you can install jshint (npm install -g jshint). Used like "$ jshint
." (recursively the current directory), or pass it the path to a directory or file.
JSHint has had many versions and the behaviour of some rules has changed over the years.
So make sure you run against the same (latest) version we use on the cluster (i.e. the
version that matters, for jenkins, 0.9.1 currently).
Some editors have their own (possibly outdated) copy of jshint (I know SublimeLinter had
an old version for a while). If you have node-jshint installed, I'd recommend
configuring the linter plugin of your editor to shell out to your version of jshint (if it
supports that).
-- Krinkle