IT:AD:jshint

Summary

We use jshint within IT:AD:Gulp tasks in order to analyse the javascript.

Notes

A default ./.jshintrc file might look like the following:

./.jshintrc
{
  "maxerr" : 50,
 
  //Enforcing:
  "bitwise"       : true,     // true: Prohibit bitwise operators (&, |, ^, etc.)
  "camelcase"     : false,    // true: Identifiers must be in camelCase
  "curly"         : true,     // true: Require {} for every new block or scope
  "eqeqeq"        : true,     // true: Require triple equals (===) for comparison
  "undef"         : true,     // true: Require all non-global variables to be declared (prevents global leaks)
 
    "maxdepth"      : 3,    // {int} Max depth of nested blocks (within functions)
    "maxstatements" : 20,    // {int} Max number statements per function
    "maxcomplexity" : 8,    // {int} Max cyclomatic complexity per function
 
  //relaxing:
  "sub"           : true,     // true: Tolerate using `[]` notation when it can still be expressed in dot notation
 
  //environments:
    "browser"       : true,     // Web Browser (window, document, etc)
    "devel"         : true,     // Development/debugging (alert, confirm, etc)
    "browserify"    : false,    // Browserify (node.js code in the browser)
    "jasmine"       : false,    // Jasmine
    "phantom"       : false,    // PhantomJS
    "prototypejs"   : false,    // Prototype and Scriptaculous
 
  "globals": {
  },
 
}

Resources