Skip to content

Commit 5cc3d49

Browse files
authored
[eprh] Add compiler rules to recommended preset (#34675)
Adds back the compiler rules to the recommended preset, intended for the next release. --- [//]: # (BEGIN SAPLING FOOTER) Stack created with [Sapling](https://sapling-scm.com). Best reviewed with [ReviewStack](https://reviewstack.dev/facebook/react/pull/34675). * #34703 * #34700 * #34699 * __->__ #34675
1 parent 289f070 commit 5cc3d49

File tree

1 file changed

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

1 file changed

+14
-1
lines changed

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

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@
77
import type {Linter, Rule} from 'eslint';
88

99
import ExhaustiveDeps from './rules/ExhaustiveDeps';
10-
import {allRules} from './shared/ReactCompiler';
10+
import {
11+
allRules,
12+
mapErrorSeverityToESlint,
13+
recommendedRules,
14+
} from './shared/ReactCompiler';
1115
import RulesOfHooks from './rules/RulesOfHooks';
1216

1317
// All rules
@@ -23,6 +27,15 @@ const rules = {
2327
const ruleConfigs = {
2428
'react-hooks/rules-of-hooks': 'error',
2529
'react-hooks/exhaustive-deps': 'warn',
30+
// Compiler rules
31+
...Object.fromEntries(
32+
Object.entries(recommendedRules).map(([name, ruleConfig]) => {
33+
return [
34+
'react-hooks/' + name,
35+
mapErrorSeverityToESlint(ruleConfig.severity),
36+
];
37+
}),
38+
),
2639
} satisfies Linter.RulesRecord;
2740

2841
const plugin = {

0 commit comments

Comments
 (0)