Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Compiler Bug]: eslint-plugin-react-compiler has incorrect type definitions #32575

Closed
1 of 4 tasks
printfn opened this issue Mar 12, 2025 · 2 comments
Closed
1 of 4 tasks
Assignees
Labels
Component: Optimizing Compiler Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug Type: Bug

Comments

@printfn
Copy link

printfn commented Mar 12, 2025

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/vitejs-vite-c52sauuy?file=eslint.config.js

Repro steps

  • Install eslint-plugin-react-compiler version 19.0.0-beta-bafa41b-20250307
  • Add reactCompiler.configs.recommended to eslint.config.js (with @ts-check enabled)
  • npx tsc -b

Error:

eslint.config.js:11:3 - error TS2345: Argument of type '{ plugins: { 'react-compiler': { rules: { 'react-compiler': RuleModule; }; }; }; rules: { 'react-compiler/react-compiler': string; }; }' is not assignable to parameter of type 'InfiniteDepthConfigWithExtends'.
  Type '{ plugins: { 'react-compiler': { rules: { 'react-compiler': RuleModule; }; }; }; rules: { 'react-compiler/react-compiler': string; }; }' is not assignable to type 'ConfigWithExtends'.
    Types of property 'rules' are incompatible.
      Type '{ 'react-compiler/react-compiler': string; }' is not assignable to type 'Partial<Record<string, RuleEntry>>'.
        Property ''react-compiler/react-compiler'' is incompatible with index signature.
          Type 'string' is not assignable to type 'RuleEntry | undefined'.

11   reactCompiler.configs.recommended,
     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Found 1 error.

How often does this bug happen?

Every time

What version of React are you using?

19.0.0

What version of React Compiler are you using?

19.0.0-beta-bafa41b-20250307

@printfn printfn added Component: Optimizing Compiler Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug Type: Bug labels Mar 12, 2025
@mofeiZ
Copy link
Contributor

mofeiZ commented Mar 12, 2025

Thanks for the report! Looks like this should be fixed if we exported declare const configs = { recommended: {... rules: 'error' | 'off' | 'warn'}} instead of rules: string. e.g. something like adding 'error' as const to this line

@poteto Do you know how the released index.d.ts is generated? It doesn't look to be in our build script

@printfn
Copy link
Author

printfn commented Mar 27, 2025

This seems to be fixed as of 19.0.0-beta-aeaed83-20250323. Thanks!

@printfn printfn closed this as completed Mar 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Optimizing Compiler Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug Type: Bug
Projects
None yet
Development

No branches or pull requests

3 participants