JSLint looks for the bad parts of your program and helps you avoid them.
JSLint helps you to follow good coding style.
JSLint helps you to write more maintainable code.
JSLint can check for common coding mistakes.
JSLint can detect potential problems in your code that may cause it to fail when it is run on other browsers or platforms.
You write code. Maybe you’ve made a mistake, maybe not…
But can you be sure?
Most editors these days come with JSLint or JSHint built-in so you can see right away if there are any issues with your code. If you’re using Sublime Text, you can install SublimeLinter and SublimeLinter-jshint to get real time feedback on your code.
It can be used on the command line as well as on a web site, it works on both Node.js and Rhino, and it can easily be integrated into any build system you might already have.
JSHint was created by Anton Kovalyov and first released in 2011. It is a fork of the older project JSLint by Douglas Crockford, which began in 2002 and has been updated since, but without official releases or documentation. While JSLint is not open source software, most of its core functionality has been made available as part of the open source JSHint project.
JSHint can be run within web browsers or from the command line. The web version allows one to check their code using default options or using settings chosen by the developer. The command-line version can be installed on Unix, macOS, and Microsoft Windows via npm.
By default, JSHint considers any reference to an undeclared variable to be an error. If you would like to allow such references, use the /*global */ directive at the top of your file to tell JSHint about them. For example:
/*global $: false, jQuery: false */