From ada8bbbd6aa76bc472863589128833e30cacaef3 Mon Sep 17 00:00:00 2001 From: Niklas Holm <572511+niklasholm@users.noreply.github.com> Date: Wed, 19 Mar 2025 19:58:08 +0100 Subject: [PATCH] [eslint-plugin-react-compiler] Fix type error with recommended config (#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'` --- compiler/packages/eslint-plugin-react-compiler/src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/packages/eslint-plugin-react-compiler/src/index.ts b/compiler/packages/eslint-plugin-react-compiler/src/index.ts index 0dd3679d56..a3577a101e 100644 --- a/compiler/packages/eslint-plugin-react-compiler/src/index.ts +++ b/compiler/packages/eslint-plugin-react-compiler/src/index.ts @@ -25,7 +25,7 @@ const configs = { }, }, rules: { - 'react-compiler/react-compiler': 'error', + 'react-compiler/react-compiler': 'error' as const, }, }, };