Skip to content

Commit 8a2ff2c

Browse files
welllaladdin-add
authored andcommittedJul 3, 2018
Docs: adding a section about disable rules for some files (#10536)
1 parent f22a3f8 commit 8a2ff2c

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed
 

‎docs/user-guide/configuring.md

+19
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,25 @@ foo(); /* eslint-disable-line example/rule-name */
448448

449449
**Note:** Comments that disable warnings for a portion of a file tell ESLint not to report rule violations for the disabled code. ESLint still parses the entire file, however, so disabled code still needs to be syntactically valid JavaScript.
450450

451+
452+
### Disabling Rules Only for a Group of Files
453+
454+
To disable rules inside of a configuration file for a group of files, use the `overrides` key along with a `files` key. For example:
455+
456+
```json
457+
{
458+
"rules": {...},
459+
"overrides": [
460+
{
461+
"files": ["*-test.js","*.spec.js"],
462+
"rules": {
463+
"no-unused-expressions": "off"
464+
}
465+
}
466+
]
467+
}
468+
```
469+
451470
## Adding Shared Settings
452471

453472
ESLint supports adding shared settings into configuration file. You can add `settings` object to ESLint configuration file and it will be supplied to every rule that will be executed. This may be useful if you are adding custom rules and want them to have access to the same information and be easily configurable.

0 commit comments

Comments
 (0)