JSHint

JSHint is a fork of Douglas Crockford’s JSLint that does not tyrannize your code!

Install

  • Install Install and activate a virtual environment:

    nave use 0.4.9
    
  • Install the node.js package for jshint:

    npm install -g jshint
    

Configuration

Create a ~/.jshintrc file like this one: https://raw.github.com/oryband/dotfiles/master/jshintrc

For other objects/classes, put the following at the top of your JavaScript script:

/* http://www.jshint.com/options/ */
/*global myTest: false */

Usage

Activate the node.js virtual environment and run the jshint command:

jshint my_script.js --show-non-errors

To use a specific configuration file:

jshint wracs/wracs/static/js/wracs/store/main.js --show-non-errors --config jshintrc

Tips

To fix the plusplus warning:

for (i = 0; i < that.selectedItems().length; i++) {
for (i = 0; i < that.selectedItems().length; i += 1) {

For more information, see ++ and -- on the JSLint page.