mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
[eprh] Add compiler rules to recommended preset
Adds back the compiler rules to the recommended preset, intended for the next release.
This commit is contained in:
@@ -7,7 +7,11 @@
|
||||
import type {Linter, Rule} from 'eslint';
|
||||
|
||||
import ExhaustiveDeps from './rules/ExhaustiveDeps';
|
||||
import {allRules} from './shared/ReactCompiler';
|
||||
import {
|
||||
allRules,
|
||||
mapErrorSeverityToESlint,
|
||||
recommendedRules,
|
||||
} from './shared/ReactCompiler';
|
||||
import RulesOfHooks from './rules/RulesOfHooks';
|
||||
|
||||
// All rules
|
||||
@@ -23,6 +27,15 @@ const rules = {
|
||||
const ruleConfigs = {
|
||||
'react-hooks/rules-of-hooks': 'error',
|
||||
'react-hooks/exhaustive-deps': 'warn',
|
||||
// Compiler rules
|
||||
...Object.fromEntries(
|
||||
Object.entries(recommendedRules).map(([name, ruleConfig]) => {
|
||||
return [
|
||||
'react-hooks/' + name,
|
||||
mapErrorSeverityToESlint(ruleConfig.severity),
|
||||
];
|
||||
}),
|
||||
),
|
||||
} satisfies Linter.RulesRecord;
|
||||
|
||||
const plugin = {
|
||||
|
||||
Reference in New Issue
Block a user