Skip to content

[eslint-plugin-react-hooks] Track useEffectEvent in FunctionExpression#36260

Open
imjordanxd wants to merge 1 commit intofacebook:mainfrom
imjordanxd:jordant/function-expression
Open

[eslint-plugin-react-hooks] Track useEffectEvent in FunctionExpression#36260
imjordanxd wants to merge 1 commit intofacebook:mainfrom
imjordanxd:jordant/function-expression

Conversation

@imjordanxd
Copy link
Copy Markdown

@imjordanxd imjordanxd commented Apr 13, 2026

Summary

While analyzing RulesOfHooks.ts, noticed that useEffectEvent tracking was handled in FunctionDeclaration, ArrowFunctionExpression, ComponentDeclaration, and HookDeclaration visitors but was missing FunctionExpression. This meant useEffectEvent references inside const Foo = function() { ... } style components were not validated. ExhaustiveDeps.ts already handles FunctionExpression — the gap was only in RulesOfHooks.ts.

Test plan

  • Added valid test: useEffectEvent in a function expression component called inside useEffect
  • Added invalid test: useEffectEvent in a function expression component passed down as a prop
  • All 5106 existing eslint-plugin-react-hooks tests pass

🤖 Generated with Claude Code

…n components

The RulesOfHooks ESLint rule tracked useEffectEvent definitions in
FunctionDeclaration, ArrowFunctionExpression, ComponentDeclaration, and
HookDeclaration nodes but missed FunctionExpression. This meant
useEffectEvent references inside `const Foo = function() { ... }` style
components were not validated.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@meta-cla meta-cla bot added the CLA Signed label Apr 13, 2026
@imjordanxd imjordanxd changed the title [eslint-plugin-react-hooks] Track useEffectEvent in FunctionExpression [eslint-plugin-react-hooks] Track useEffectEvent in FunctionExpression Apr 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant