[Compiler Bug]: set-state-in-effect false negative whenever tagged template literals are present
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 251k
- Forks
- 51.4k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 53
Description
What kind of issue is this?
- React Compiler core (the JS output is incorrect, or your app works incorrectly after optimization)
- babel-plugin-react-compiler (build issue installing or using the Babel plugin)
- eslint-plugin-react-compiler (build issue installing or using the eslint plugin)
- react-compiler-healthcheck (build issue installing or using the healthcheck script)
Link to repro
https://stackblitz.com/edit/stackblitz-starters-9kernjp2?file=app%2Fpage.tsx
Repro steps
React Compiler appears to bail out of functions whenever a tagged template literal is present. I've tested this with the set-state-in-effect rule but I believe this causes false negatives for any ESLint rule which uses the compiler. Some rules like exhaustive-deps, that I assume do not use the compiler, are unaffected.
Steps to reproduce
- Write an invalid code snippet you expect to fail the set-state-in-effect rule
- Include a tagged template literal anywhere inside the same component as the invalid code
- Observe that the presence of the tagged template literal causes the error to be suppressed
I've included a small reproduction with both set-state-in-effect and exhaustive-deps violations. Running npm run lint shows only the exhaustive-deps failure unless you comment out the tagged template
This might already be on your radar as React Compiler not supporting tagged template literals seems to be a known issue and this error prevents lowering to HIR
How often does this bug happen?
Every time
What version of React are you using?
19
What version of React Compiler are you using?
1.0
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the StackBlitz reproduction in app/page.tsx and run npm run lint to confirm that the tagged template suppresses the set-state-in-effect error while exhaustive-deps still reports. Then read the referenced BuildHIR.ts locations for tagged-template handling and HIR lowering. Done means the invalid set-state-in-effect code is reported even when a tagged template literal is present.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100