What kind of issue is this?
Link to repro
https://github.com/michaeljaltamirano/eslint-plugin-react-hooks-issue
Repro steps
Hi Team,
First and foremost, thank you for eslint-plugin-react-hooks, and continued development on making it more performant + more accurately surfacing violations.
I noticed while upgrading a large repo from 7.0.1 to 7.1.1 that there were some regressions in reported rules, identified by ESLint v9 settings that error on unreported rules. While looking at the full diff, I realized the root cause was pretty straight-forward: any component with an in-lined React.memo, memo, or forwardRef wrapper around the component variable declaration would suppress reporting, due to the skip compilation changes added in 7.1.0: #35589
Here are two screenshots that succinctly illustrate the issue:
Expected behavior: component reports react-hooks lint violations regardless of definition syntax, and so Screenshot 2 should show the same errors as Screenshot 1.
Reproducible behavior: component definitions that in-line memo or forwardRef, e.g. export const SomeComponent = memo(function SomeComponent({}), skip react-hooks linting, which is why Screenshot 2 does not show lint errors.
A temporary work-around of moving the in-lined wrapper functions away from the component definition , e.g. export default memo(SomeComponent), is sufficient to resolve the issue, but can result in noisy diffs where there are large indentation changes.
I have added a repro repo here: https://github.com/michaeljaltamirano/eslint-plugin-react-hooks-issue. The README and source is AI-generated, but it matches the manual regression testing I performed in a private repo. This issue is limited to eslint-plugin-react-hooks: react itself still reports all 4 cases as a compiler violation (here is a Compiler Playground link that shows as much).
I will be opening a PR based on https://github.com/michaeljaltamirano/react/tree/fix/memo-heuristic-variable-declaration, which was also AI generated. I read through https://legacy.reactjs.org/docs/how-to-contribute.html and ran the relevant yarn scripts to double-check unintended regressions.
How often does this bug happen?
Every time
What version of React are you using?
19.2.6
What version of React Compiler are you using?
1.0.0
What version of eslint-plugin-react-hooks are you using?
7.1.0. The regression does not exist in 7.0.1.
What kind of issue is this?
Link to repro
https://github.com/michaeljaltamirano/eslint-plugin-react-hooks-issue
Repro steps
Hi Team,
First and foremost, thank you for
eslint-plugin-react-hooks, and continued development on making it more performant + more accurately surfacing violations.I noticed while upgrading a large repo from
7.0.1to7.1.1that there were some regressions in reported rules, identified by ESLint v9 settings that error on unreported rules. While looking at the full diff, I realized the root cause was pretty straight-forward: any component with an in-linedReact.memo,memo, orforwardRefwrapper around the component variable declaration would suppress reporting, due to the skip compilation changes added in7.1.0: #35589Here are two screenshots that succinctly illustrate the issue:
Expected behavior: component reports
react-hookslint violations regardless of definition syntax, and so Screenshot 2 should show the same errors as Screenshot 1.Reproducible behavior: component definitions that in-line
memoorforwardRef, e.g.export const SomeComponent = memo(function SomeComponent({}), skipreact-hookslinting, which is why Screenshot 2 does not show lint errors.A temporary work-around of moving the in-lined wrapper functions away from the component definition , e.g.
export default memo(SomeComponent), is sufficient to resolve the issue, but can result in noisy diffs where there are large indentation changes.I have added a repro repo here: https://github.com/michaeljaltamirano/eslint-plugin-react-hooks-issue. The README and source is AI-generated, but it matches the manual regression testing I performed in a private repo. This issue is limited to
eslint-plugin-react-hooks:reactitself still reports all 4 cases as a compiler violation (here is a Compiler Playground link that shows as much).I will be opening a PR based on https://github.com/michaeljaltamirano/react/tree/fix/memo-heuristic-variable-declaration, which was also AI generated. I read through https://legacy.reactjs.org/docs/how-to-contribute.html and ran the relevant
yarnscripts to double-check unintended regressions.How often does this bug happen?
Every time
What version of React are you using?
19.2.6
What version of React Compiler are you using?
1.0.0
What version of
eslint-plugin-react-hooksare you using?7.1.0. The regression does not exist in 7.0.1.