jshint.com is a blog with relevant information to jshint and how useful it is for web developers.
One of the main reasons I am writing this blog is because I have seen a lot of people who are confused about some of these tools, so I thought it would be beneficial to clear up some misconceptions.
var foo = “bar”;
This will work just fine in Google Chrome or Firefox, but it will not work in Internet Explorer (IE). The reason for this is that
JSHint is also available as an extension for some web browsers, and can be installed on Node.js using npm. The project is open source and hosted on GitHub.
JSHint was created by Anton Kovalyov in 2011 as a fork of Douglas Crockford’s JSLint. The goal was to reduce friction in building websites by allowing developers to write more useful warnings and error messages than JSLint provided at the time.
JSHint will show warnings if it encounters constructs that are likely to be mistakes. It is not a linter, so it will allow you to make syntax errors. JSHint is an open source tool that has been around for a while and can be used within your IDE, text-editor, or the command line.
JSHint offers a web interface for configuring which rules you would like to use for your project. You can choose from the list of available rules or create your own custom rule set. The configuration page also allows you to test your code against the selected set of rules with an easy copy and paste interface.
JSHint is not a validator, it is a linter (a tool that reports on patterns in code). JSLint is the original tool created by Douglas Crockford. It was designed as a replacement for the standard lint tool which was released with Unix systems. JSLint will only look at your code and do its best to apply a set of rules to the code to check if it is valid or not. If it encounters an issue, it will either display an error message or possibly fix the error itself.
The main reason for developing this tool was to eliminate the so-called “Watchers”. Every developer has experienced a situation when you make changes to the code, save the file, switch back to the browser where you left off, hit Refresh and… nothing happens! Or worse, there are unhandled exceptions being thrown all over your console. It’s really frustrating having to check everything in the console just to make sure that everything is fine and then return to coding.
JSHint takes care of that by reporting errors/warnings right when you save your file. It also reports them in your terminal via Node.js if you are using it that way.
The simplest way to start using JsHint is to use the online interface, but if you are working on a project with many files, it will be more efficient to install JsHint locally.
JsHint has several ways of installation: as a Node program or as a browser extension. Also you can use it with Grunt or Gulp, two popular build systems for Node.