Any code base eventually becomes huge at some point, and simple mistakes–that would not show themselves when written–can become show stoppers and waste hours of debugging. And this is when static code analysis tools come into play and help developers to spot such problems.
Note: While static code analysis tools can spot many different kind of mistakes, it can’t detect if our program is correct, fast or has memory leaks. We should always combine tools like JSHint with unit and functional tests as well as with code reviews.
jsLint: by Douglas Crockford
jsHint: Community-driven jsLint branch that went a bit separate way
Google Closure Linter
Google Clouse Compiler
The problem is not necessarily a syntax error, although it often is. JSLint looks at some style conventions as well as structural problems. It does not prove that our program is correct. It just provides another set of eyes to help spot problems.
The main difference between jsHint and jsLint is that jsHint is customizable. We can enable/disable all of the style features. It’s not that strict as jsLint, but if we have a large amount of legacy code that should be lintered, it provides us with ability to disable some rules for our code to run properly.
Google Closure Linter
A good utility, easy to install (with easy_install), doesn’t bother user with options and settings, just works from the box and checks your syntax, not going too deep into bugs and stuff. If you and your team are fans of Google style recommendations and use Eclipse for development that might be the tools just for you.
But, on the other hand, with support by many IDE’s jsLint can be used to highlight problems on the fly, so at least new code will be well written.
Very customizable. From the box can check both syntax problems and search for possible bugs, but can become much stricter if you need it. Same as jsLint, has support if many popular IDE’s and can be set up to highlight possible problems. If you need to set some custom code conventions for your team – this is the tool for you. You can always tune the set of rules however you want, and even make it as strict as jsLint.