Skip to content

Commit

Permalink
Revert "docs: remove confusing examples for no-mixed-operators (eslin…
Browse files Browse the repository at this point in the history
…t#15875)"

This reverts commit abcc769.
  • Loading branch information
srijan-deepsource committed May 30, 2022
1 parent cd9dee9 commit 163dcde
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions docs/src/rules/no-mixed-operators.md
Expand Up @@ -12,6 +12,8 @@ This rule warns when different operators are used consecutively without parenthe

```js
var foo = a && b || c || d; /*BAD: Unexpected mix of '&&' and '||'.*/
var foo = a && b ? c : d; /*BAD: Unexpected mix of '&&' and '?:'.*/
var foo = (a && b) ? c : d; /*GOOD*/
var foo = (a && b) || c || d; /*GOOD*/
var foo = a && (b || c || d); /*GOOD*/
```
Expand All @@ -30,6 +32,17 @@ will generate
1:18 Unexpected mix of '&&' and '||'. (no-mixed-operators)
```

```js
var foo = a && b ? c : d;
```

will generate

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

## Rule Details

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

0 comments on commit 163dcde

Please sign in to comment.