Skip to content

Commit eaba42e

Browse files
committed
[eslint-plugin-react-hooks] add test showing broken behavior
1 parent aa80a30 commit eaba42e

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,17 @@ const tests = {
406406
const [myState, setMyState] = useState(null);
407407
}
408408
`,
409+
`
410+
// Valid, but should be invalid. '_useHook' is currently recognized as a component.
411+
function Component(props) {
412+
if (cond) {
413+
_useHook();
414+
}
415+
}
416+
function _useHook() {
417+
useState(null);
418+
}
419+
`,
409420
],
410421
invalid: [
411422
{

0 commit comments

Comments
 (0)