Skip to content

Commit

Permalink
Docs: Clarify expected behavior of no-mixed-operators rule
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 eslint#8051.
  • Loading branch information
ruxandrafed committed Oct 10, 2017
1 parent 786cc73 commit 33180f6
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 the 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 33180f6

Please sign in to comment.