For some reason, I'm often forgetting how to set JSLint options in Darren DeRidder's excellent Sublime Text 2 plugin for JSLint.

Here's how:

You can set any of jslint's options under preference -> package settings -> jslint -> advanced built settings. See http://www.jslint.com/lint.html#options for a list of options in JSLint. There's no move_var option (that's just a label for an error condition), but you can use the vars: true option to permit many variable declarations per function.

Now any other random blog would stop there.  Done.  You're on your own.  But not freakinname.  No no, we also clutter up the net with some bonus bytes showing what options I'm currently using.  Why?  To jump start your own JSLinting?  Oh no, no, it's in case I set up a new box again, natch.

 {
    "cmd": [
      "node", 
      "${packages}/JSLint/linter.js",
      // sloppy line breaking?

      // tolerate dangling _ in identifiers
      "--nomen",
      // tolerate ++ and --
      "--plusplus",
      // tolerate missing 'use strict' pragma
      "--sloppy",
      // sloppy whitespace
      "--white",

      // assume a browser,
      "--browser",

      // suggest an indent level of ...
      "--indent", "4",
      // assume node.js to predefine node globals
      "--node",

      // tolerate unfiltered for in
      //"--forin",

      // tolerate stupidity
      "--stupid",

      // tolerate todo
      "--todo",

      // anon whitespace okay 
      //"--anon",

      "--maxerr","6",

      "$file"
    ],
    "file_regex": "^\\/.*\\/([^\\/]*)$",
    "line_regex": ".*\/\/ Line ([0-9]*), Pos ([0-9]*)$",
    "selector": "source.js, source.css, source.json, source.sass, source.less, source.html"
}


You're welcome.  ;^)

Labels: ,