Skip to content

Commit 05124cd

Browse files
author
Pascal Fong Kye
committed
add test on optional chaining in dependency
1 parent e68b26b commit 05124cd

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

packages/eslint-plugin-react-hooks/__tests__/ESLintRuleExhaustiveDeps-test.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,18 @@ const tests = {
279279
}
280280
`,
281281
},
282+
{
283+
code: normalizeIndent`
284+
function MyComponent() {
285+
const x = true ? { test: true } : undefined;
286+
React.useEffect(() => {
287+
if (x?.test) {
288+
console.log("testing");
289+
}
290+
}, [x?.test]);
291+
}
292+
`,
293+
},
282294
{
283295
code: normalizeIndent`
284296
function MyComponent(props) {

0 commit comments

Comments
 (0)