Skip to content

Commit

Permalink
Docs: Clarify eslint-disable comments only affect rules (fixes #5005)
Browse files Browse the repository at this point in the history
  • Loading branch information
btmills committed Jan 30, 2016
1 parent 3ef6d73 commit 0d87f5d
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions docs/user-guide/configuring.md
Original file line number Diff line number Diff line change
Expand Up @@ -338,18 +338,18 @@ In these configuration files, the rule `plugin1/rule1` comes from the plugin nam

All rules that are enabled by default are set to 2, so they will cause a non-zero exit code when encountered. You can lower these rules to a warning by setting them to 1, which has the effect of outputting the message onto the console but doesn't affect the exit code.

To temporary disable warnings in your file use the following format:
To temporary disable rule warnings in your file use the following format:

```js
/*eslint-disable */
//suppress all warnings between comments
//Disable all rules between comments
alert('foo');
/*eslint-enable */
```

You can also disable and enable back warnings of specific rules
You can also disable or enable warnings for specific rules:

```js
/*eslint-disable no-alert, no-console */
Expand All @@ -360,18 +360,20 @@ console.log('bar');
/*eslint-enable no-alert */
```

To disable warnings on a specific line
To disable all rules on a specific line:

```js
alert('foo'); // eslint-disable-line
```

To disable a specific rule on a specific line
To disable a specific rule on a specific line:

```js
alert('foo'); // eslint-disable-line no-alert
```

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

## Adding Shared Settings

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.
Expand Down

0 comments on commit 0d87f5d

Please sign in to comment.