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 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": [
      // sloppy line breaking?

      // tolerate dangling _ in identifiers
      // tolerate ++ and --
      // tolerate missing 'use strict' pragma
      // sloppy whitespace

      // assume a browser,

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

      // tolerate unfiltered for in

      // tolerate stupidity

      // tolerate todo

      // anon whitespace okay 


    "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: ,