[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
lauren committed
Oct 2, 2025 at 18:42 UTC
5cc3d49f72a9e78cce61f7fbfc1b7455f313cebe
1 file changed
+14
-1
packages/eslint-plugin-react-hooks/src/index.ts
+14
-1
@@ -7,7 +7,11 @@
7
import type {Linter, Rule} from 'eslint';
8
9
import ExhaustiveDeps from './rules/ExhaustiveDeps';
10
-import {allRules} from './shared/ReactCompiler';
10
+import {
11
+ allRules,
12
+ mapErrorSeverityToESlint,
13
+ recommendedRules,
14
+} from './shared/ReactCompiler';
15
import RulesOfHooks from './rules/RulesOfHooks';
16
17
// All rules
@@ -23,6 +27,15 @@ const rules = {
27
const ruleConfigs = {
28
'react-hooks/rules-of-hooks': 'error',
29
'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
+ ),
39
} satisfies Linter.RulesRecord;
40
41
const plugin = {