diff --git a/docs/src/rules/no-mixed-operators.md b/docs/src/rules/no-mixed-operators.md index 831bd3626ef..48f8849a70b 100644 --- a/docs/src/rules/no-mixed-operators.md +++ b/docs/src/rules/no-mixed-operators.md @@ -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*/ ``` @@ -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`.