Skip to content

[compiler] Fix refs lint false positives for JSX ref props#36416

Open
raashish1601 wants to merge 1 commit intofacebook:mainfrom
raashish1601:codex/refs-jsx-prop-alias
Open

[compiler] Fix refs lint false positives for JSX ref props#36416
raashish1601 wants to merge 1 commit intofacebook:mainfrom
raashish1601:codex/refs-jsx-prop-alias

Conversation

@raashish1601
Copy link
Copy Markdown

Summary

The refs lint rule was aliasing non-current property loads back to their parent object. When a JSX ref attribute inferred props.ref, props.buttonRef, or groupRefs.group1 as a ref, the parent object was then treated as a ref too, which made sibling props or sibling ref entries look like ref.current accesses during render.

This keeps property-load values separate in the ref validation environment so JSX ref forwarding remains valid while direct props.ref.current reads still report.

Fixes #35575
Fixes #34775
Fixes #35813
Fixes #35997

How did you test this change?

  • corepack yarn --cwd packages/eslint-plugin-react-hooks build:compiler
  • corepack yarn --cwd packages/eslint-plugin-react-hooks jest ReactCompilerRuleTypescript-test --runInBand
  • corepack yarn --cwd packages/eslint-plugin-react-hooks typecheck
  • git diff --check

@meta-cla meta-cla Bot added the CLA Signed label May 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

1 participant