Fork me on GitHub

Semicolon-Agnostic Javascript Syntax Checking with JSHint

Douglas Crockford's Javascript syntax checker, JSLint, has served the community well, but is opinionated and inflexible. If you program Javascript and omit unnecessary semicolons, for example, JSLint will continually badger you about your style choice.

Enter JSHint, a community fork of JSLint. JSHint offers many configurable options, including an option that stops the incessant semicolon warnings. If you have Node.js and the Node Package Manager (npm) installed, you can easily set up JSHint as a command line application: simply "npm install jshint".

Once you've installed JSHint, you'll wish to configure it. My configuration, which suppresses semicolon warnings with the "asi" option enabled, lives here. To run JSHint specifying a configuration file, enter something similar to the following into your shell:

$ jshint someJsFile.js --config /path/to/config.json

If you'd like to automatically run JSHint with a configuration file, you may wish to include a wrapper function, similar to the following, in your .bashrc file (or .bash_profile if you're on OS X):

function hint() {
  jshint $1 --config /path/to/config.json

This will enable you to check a file by simply entering the following in your shell:

$ hint someJsFile.js