Skip to content

Commit e68b26b

Browse files
author
Pascal Fong Kye
committed
Fixes eslint warning when node type is ChainExpression
1 parent d2e914a commit e68b26b

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

packages/eslint-plugin-react-hooks/src/ExhaustiveDeps.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1622,6 +1622,15 @@ function analyzePropertyChain(node, optionalChains) {
16221622
optionalChains.set(result, false);
16231623
}
16241624
}
1625+
return result;
1626+
} else if (node.type === 'ChainExpression' && !node.computed) {
1627+
const result = analyzePropertyChain(node.expression, optionalChains);
1628+
1629+
if (optionalChains) {
1630+
// Mark as required.
1631+
optionalChains.set(result, false);
1632+
}
1633+
16251634
return result;
16261635
} else {
16271636
throw new Error(`Unsupported node type: ${node.type}`);

0 commit comments

Comments
 (0)