react-hooks-js/unsupported-syntax
Validates against syntax that we do not plan to support in React Compiler
- Category: React Compiler
- Severity: error
- Source:
eslint-plugin-react-hooks - Framework: global
- Enabled when: eslint-plugin-react-hooks v6+ installed AND React Compiler detected in project
- Documentation: https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax
Validation prompt
Use this to decide whether a fired diagnostic is real or a false positive.
Fires on syntax the Compiler permanently will not support — eval(...), with (...) {}, and the Function constructor — when used inside a component or hook. Both prevent any static analysis. False positive: the call sits in a non-component utility module the Compiler already skips (in that case the warning typically should not appear).
Fix prompt
Use this once validation confirms the diagnostic is real.
Replace eval with bracket access (props[name] instead of eval('props.' + name)), JSON.parse for serialized data, or a dedicated expression parser like mathjs for arithmetic. Delete with statements and reference properties explicitly (Math.sin instead of with (Math) { sin(...) }). The legacy syntax has been discouraged for decades and modern equivalents exist for every use case. See https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax