Recent Changes - Search:

edit SideBar

JSHint

JSLint is a bit too aggressive, so we are using JSHint

To install JSHint, use

  npm install jshint

In Ptolemy, the build.xml.in file has two rules:

  • ant jshint - Runs jshint and writes the results to stdout.
  • ant jshint-checkstyle - Runs jshint and generates checkstyle-compatibile output in $PTII/reports/jshintFixed.xml

See http://terra.eecs.berkeley.edu:8080/job/ptII/checkstyle for the nightly build output.

Style

Below the file-wide comment, there should be the following:

// Stop extra messages from jslint and jshint.  Note that there should
// be no space between the / and the * and global. See                        
// https://chess.eecs.berkeley.edu/ptexternal/wiki/Main/JSHint
/*globals addInputHandler, accessor, exports, get, removeInputHandler, require, send  */
/*jshint globalstrict: true*/
'use strict';

Comment (Ben): According to JSHint Documentation (http://jshint.com/docs/), you can have spaces between `/*` and `globals`.

It is a best practice to customize the list of globals individually for each file. The idea is that not every global should be listed, instead list on the globals that are used in the file.

See Also

External References

Back to JS

Edit - History - Print - Recent Changes - Search
Page last modified on February 03, 2016, at 10:08 AM