From 3bf864de2cfa1ce601ebf06aa90aacd9f8421f7c Mon Sep 17 00:00:00 2001 From: Sean Gray Date: Mon, 23 Dec 2019 21:44:08 -0800 Subject: [PATCH] Update: no-constant condition now requires direct parent to be binary expression --- lib/rules/no-constant-condition.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/rules/no-constant-condition.js b/lib/rules/no-constant-condition.js index 744b8c6245f..58691b6da6d 100644 --- a/lib/rules/no-constant-condition.js +++ b/lib/rules/no-constant-condition.js @@ -103,10 +103,10 @@ module.exports = { return true; case "ArrayExpression": { - if (!(node.parent.operator === "+")) { - return true; + if (node.parent.operator === "+" && node.parent.type === "BinaryExpression") { + return node.elements.every(element => isConstant(element, false)); } - return node.elements.every(element => isConstant(element, false)); + return true; } case "UnaryExpression":