Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you disable indent checking on esLint?

Tags:

eslint

The indent rule seems impossible to disable; how (in config settings) do I disable this rule? thanks.

like image 269
Dave Edelhart Avatar asked Feb 23 '16 23:02

Dave Edelhart


People also ask

How do I disable ESLint check?

To temporarily turn off ESLint, you should add a block comment /* eslint-disable */ before the lines that you're interested in: /* eslint-disable */ console.

How do I disable ESLint for multiple lines?

For those converting eslint-disable-next-line to eslint-disable (for multiple lines), remember two things. 1. /* */ instead of // 2. It's eslint-disable and not eslint-disable-next-line . Just reiterating coz I did the same and had to search many more things due to the 2nd point.


4 Answers

Set the rule to "off" in your config like this:

"rules": {
  "indent": "off"
}

You can read more in the docs here.

like image 106
Vincent Orback Avatar answered Oct 24 '22 19:10

Vincent Orback


For indentation, I usually let it activated in config and disable it only in some files where I need a fancy indentation, hence I use the comment

/* eslint-disable indent */

It is worth to note that this works also with standardjs that I use a lot, as well as on any other linter powered by eslint. For example I created a lighter version of standardjs, that is called standa that is standardjs minus the React part (yes this is the auto promotion part but I hope sharing this can be useful to many others than me :) that uses the great standard engine which relies on eslint, so everything just work with no extra line of code from me.

like image 35
Gianluca Casati Avatar answered Oct 24 '22 21:10

Gianluca Casati


I had to add more rules. To turn off linting for react and jsx-indent

"rules": {
    "indent": "off",
    "react/jsx-indent": "off",
    "react/jsx-indent-props": "off"
}
like image 14
Saahithyan Vigneswaran Avatar answered Oct 24 '22 19:10

Saahithyan Vigneswaran


This is the one that worked for me

"indent": ["error", ""],
like image 1
Alex DS Avatar answered Oct 24 '22 20:10

Alex DS