Skip to content

Commit ada8bbb

Browse files
authored
[eslint-plugin-react-compiler] Fix type error with recommended config (facebook#32666)
## Summary In the recommended configuration for `eslint-plugin-react-compiler`, i.e. `reactCompiler.configs.recommended`, the rule is typed as `string` rather than `eslint.Linter.RuleEntry` or anything assignable thereto, which results in the following type error if you type check your eslint configuration: ``` Property ''react-compiler/react-compiler'' is incompatible with index signature. Type 'string' is not assignable to type 'RuleEntry | undefined'. ``` Simply adding a const assertion fixes the error. ## How did you test this change? I emitted declarations for the module and confirmed that the rule is now typed as the string literal `'error'`
1 parent e9c3b27 commit ada8bbb

File tree

1 file changed

+1
-1
lines changed
  • compiler/packages/eslint-plugin-react-compiler/src

1 file changed

+1
-1
lines changed

compiler/packages/eslint-plugin-react-compiler/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const configs = {
2525
},
2626
},
2727
rules: {
28-
'react-compiler/react-compiler': 'error',
28+
'react-compiler/react-compiler': 'error' as const,
2929
},
3030
},
3131
};

0 commit comments

Comments
 (0)