Recommended way to disable eslint rules
mmkal opened this issue · 2 comments
Hi there - I'm trying to set up a small simple project with xo, but there are a few rules that I'd like to disable. The docs say:
Is that the only way they can be configured? If so, does that mean that every file needs to have /* eslint-disable unicorn/no-array-for-each */
at the top of it? There's a stackoverflow answer that suggests there's a workaround, but can something be added to the docs to indicate whether this is a legit way to disable rules, and should be respected by the various tools like vscode plugins?
disable the rule in your xo configuration to turn it off globally in your project.
package.json
{
"xo": {
"rules": {
"unicorn/no-array-for-each": "off"
}
}
}
You could also use .xo-config.json
or one of the other config file formats supported by xo.
it's the same rule configuration for eslint - "off" is valid, [0] is valid, false is not.