How to turn off JSLint indentation warnings?

Greg Mattes picture Greg Mattes · Aug 12, 2009 · Viewed 21.5k times · Source

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.

Answer

Greg Mattes picture Greg Mattes · Aug 12, 2009

What a difference that morning coffee makes:

/*jslint white: true */