]> git.proxmox.com Git - pve-eslint.git/blobdiff - eslint/lib/rules/no-extra-boolean-cast.js
import 7.12.1 upstream release
[pve-eslint.git] / eslint / lib / rules / no-extra-boolean-cast.js
index b90757b112658c8bcd8ad869230574ae58bf12f5..6ae3ea62ca77d67b064f113d197e03f137893f1a 100644 (file)
@@ -111,6 +111,10 @@ module.exports = {
          * @returns {boolean} If the node is in one of the flagged contexts
          */
         function isInFlaggedContext(node) {
+            if (node.parent.type === "ChainExpression") {
+                return isInFlaggedContext(node.parent);
+            }
+
             return isInBooleanContext(node) ||
             (isLogicalContext(node.parent) &&
 
@@ -149,6 +153,9 @@ module.exports = {
          * @returns {boolean} `true` if the node needs to be parenthesized.
          */
         function needsParens(previousNode, node) {
+            if (previousNode.parent.type === "ChainExpression") {
+                return needsParens(previousNode.parent, node);
+            }
             if (isParenthesized(previousNode)) {
 
                 // parentheses around the previous node will stay, so there is no need for an additional pair