From c4cf46670e7ad4b024cf8a50482974265b8490f5 Mon Sep 17 00:00:00 2001 From: Ruxandra Fediuc Date: Mon, 9 Oct 2017 15:15:48 -0700 Subject: [PATCH] Docs: Clarify expected behavior of `no-mixed-operators` rule 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. --- docs/rules/no-mixed-operators.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/docs/rules/no-mixed-operators.md b/docs/rules/no-mixed-operators.md index b6f6fb6e8edf..5eafdb260ef4 100644 --- a/docs/rules/no-mixed-operators.md +++ b/docs/rules/no-mixed-operators.md @@ -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`.