mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
## 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'`
34 lines
654 B
TypeScript
34 lines
654 B
TypeScript
/**
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/
|
|
|
|
import ReactCompilerRule from './rules/ReactCompilerRule';
|
|
|
|
const meta = {
|
|
name: 'eslint-plugin-react-compiler',
|
|
};
|
|
|
|
const rules = {
|
|
'react-compiler': ReactCompilerRule,
|
|
};
|
|
|
|
const configs = {
|
|
recommended: {
|
|
plugins: {
|
|
'react-compiler': {
|
|
rules: {
|
|
'react-compiler': ReactCompilerRule,
|
|
},
|
|
},
|
|
},
|
|
rules: {
|
|
'react-compiler/react-compiler': 'error' as const,
|
|
},
|
|
},
|
|
};
|
|
|
|
export {configs, rules, meta};
|