
JSHint, A JavaScript Code Quality Tool - joeyespo
http://www.jshint.com/
======
bdg
I'm a bit of an evangelical when it comes to static code analysis like this. I
insist your code should work to a spec-- not necessarily Crockford's JSLint
spec, but _a_ spec, which is why I really like JSHint.

But I find I can't really convince anyone of it being useful, I remember being
in an interview for a startup I read about on here and started talking about
this as a tool I use (they asked "What tools do you use"). They basically
brushed it off as "yeah, I don't think this is super useful, we probably have
bigger problems than a missing semicolon".

As I understand it, general perception of people seems to be it's a tool for
finding missing semicolons. I don't know how to give this a decent elevator
pitch so other people can see the light.

~~~
bcrescimanno
John Carmack wrote a great blog post a while back about Static Code Analysis.

<http://altdevblogaday.com/2011/12/24/static-code-analysis/>

While not all of this is immediately applicable to JSHint and the like, it
provides some insight into why static code analysis can be seen as helpful.

As you also mention, it's really helpful for code within a codebase to be
consistently written. JSHint can help enforce some of that consistency. This
is where JSHint really shines.

If your JS is tied to some sort of "build" process (even a short 1-2 second
one), catching errors before running the build is incredibly helpful. If you
intend to minify your JS code (as you should) before distribution, finding
missing semicolons can be very important, indeed. I find the most helpful
JSHint errors to be about mistyped variable names. It's so much easier to see
that in my editor, fix it, and THEN run it in the browser.

------
johnweir
I have been using the jshint vim plugin

<http://www.vim.org/scripts/script.php?script_id=3576>

<https://github.com/walm/jshint.vim>

This has really helped catch some dumb errors and even make some nice
recommendations.

~~~
bcrescimanno
You might check out Syntastic. It supports JSHint if you have it installed and
also supports other languages. I switched to it after using the JSHint plugin
for a while.

<https://github.com/scrooloose/syntastic>

~~~
johnweir
Very nice. Thanks.

------
taylorbuley
In an ideal world, I'd put every piece of JS I write first through jslint and
then through jshint -- maybe even using git hooks

------
jzting
TextMate bundle is quite nice as well: <http://fgnass.posterous.com/jslint-in-
textmate>

------
msarchet
Would be really nice if I didn't have to scroll down to see errors.

~~~
joshuacc
Ideally, you won't be using the web interface, but running the command line
utility version.

My company recently implemented this as part of a git pre-commit hook so that
we're less likely to have a silly syntax mistake cause problems.

------
eric-hu
If anyone has integrated this into a Coffeescript development cycle, I'd love
to hear about how you've done it.

