Skip to content

Commit

Permalink
Docs: clarify no-mixed-operators (fixes #8051)
Browse files Browse the repository at this point in the history
Update docs for `no-mixed-operators` to clarify that a pair of errors will be triggered for each pair of mixed consecutive operators used. Fixes #8051.
  • Loading branch information
ruxandrafed authored and kaicataldo committed Oct 11, 2017
1 parent 51360c8 commit e835dd1
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions docs/rules/no-mixed-operators.md
Expand Up @@ -9,6 +9,21 @@ var foo = (a && b) || c || d; /*GOOD*/
var foo = a && (b || c || d); /*GOOD*/
```

**Note:**
It is expected for this rule to emit one error for each mixed operator in a pair. As a result, for each two consecutive mixed operators used, a distinct error will be displayed, pointing to where the specific operator that breaks the rule is used:

```js
var foo = a && b || c || d;
```

will generate

```sh
1:13 Unexpected mix of '&&' and '||'. (no-mixed-operators)
1:18 Unexpected mix of '&&' and '||'. (no-mixed-operators)
```


## Rule Details

This rule checks `BinaryExpression` and `LogicalExpression`.
Expand Down

0 comments on commit e835dd1

Please sign in to comment.