views:

332

answers:

1

I find that JSLint produces lots of warnings of the form:

Expected 'foo' to have an indentation at X instead at Y.

The JSLint options documentation describes an indent option that recognizes a numerical value representing the amount of space for each level of indentation. This option allows me to say things like use 2 spaces per level of indentation. I just write something like this at the top of my JavaScript file:

/*jslint indent: 2 */

OK, great. Now JSLint knows how much to indent for each level of indentation, but JSLint seems to be hardcoded to decide what level of indentation each line should have.

Suppose I want to indent my code differently than the way JSLint prescribes. Can I do this with some JSLint option? If not, can I at least turn off the indentation warnings? I tried:

/*jslint indent: false */

but that did not cause indentation warnings to be elided; it caused a JSLint error.

+3  A: 

What a difference that morning coffee makes:

/*jslint white: false */
Greg Mattes
Of course, this still doesn't addressthe issue of specifying another formatting style.
Greg Mattes