From 594444704d531d0bb536d8e7c7b0c0327348a9ad Mon Sep 17 00:00:00 2001 From: Milos Djermanovic Date: Tue, 24 Mar 2020 03:01:39 +0100 Subject: [PATCH] Specify assumptions for `needsParens` --- lib/rules/no-extra-boolean-cast.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/rules/no-extra-boolean-cast.js b/lib/rules/no-extra-boolean-cast.js index d083eea6e5d..aba8e63e086 100644 --- a/lib/rules/no-extra-boolean-cast.js +++ b/lib/rules/no-extra-boolean-cast.js @@ -141,6 +141,9 @@ module.exports = { /** * Determines whether the given node needs to be parenthesized when replacing the previous node. + * It assumes that `previousNode` is the node to be reported by this rule, so it has a limited list + * of possible parent node types. By the same assumption, the node's role in a particular parent is already known. + * For example, if the parent is `ConditionalExpression`, `previousNode` must be its `test` child. * @param {ASTNode} previousNode Previous node. * @param {ASTNode} node The node to check. * @returns {boolean} `true` if the node needs to be parenthesized.