Is it possible to configure ESLint in a way that it only applies rules to files that names are matching certain pattern? I know it's possible to have separate rule sheets in directories, but in case the structure is following:
app | |- module1 | |- module1.js | |- module1.spec.js | |- module2 | |- module2.js | |- module2.spec.js
And I want a project-wide rules that would only apply to the *.spec.js files. I'd expect to have a setting like
"include-pattern": "*.spec.js"
in the .eslintrc or any other, simlilar way to specify which filenames should be considered for specific rules.
The // eslint-disable-line comment disables the no-eval rule for just that line. You can also disable the no-eval rule for an entire function block by using /* eslint-disable */ .
Updated answer:
Yes, now it's possible. In your example it could look like
{ "rules": { "quotes": [ 2, "double" ] }, "overrides": [ { "files": [ "app/module1/*.js" ], "excludedFiles": "*.spec.js", "rules": { "quotes": [ 2, "single" ] } } ] }
You can read more at eslint doc page.
Old answer:
Currently this is not supported. But for 2.0.0
version we are actively working on this feature.
To track progress: https://github.com/eslint/eslint/issues/3611
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With