How do you disable indent checking on esLint?

前端 未结 3 573
星月不相逢
星月不相逢 2021-02-11 13:04

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

相关标签:
3条回答
  • 2021-02-11 13:19

    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.

    0 讨论(0)
  • 2021-02-11 13:20

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

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

    You can read more in the docs here.

    0 讨论(0)
  • 2021-02-11 13:32

    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"
    }
    
    0 讨论(0)
提交回复
热议问题