Skip to content

Commit 8812f26

Browse files
committed
[compiler] Enable additional lints by default
Enable more validations to help catch bad patterns, but only in the linter. These rules are already enabled by default in the compiler _if_ violations could produce unsafe output.
1 parent 260d6ff commit 8812f26

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

compiler/packages/eslint-plugin-react-compiler/src/rules/ReactCompilerRule.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,12 @@ const COMPILER_OPTIONS: Partial<PluginOptions> = {
107107
flowSuppressions: false,
108108
environment: validateEnvironmentConfig({
109109
validateRefAccessDuringRender: false,
110+
validateNoSetStateInRender: true,
111+
validateNoSetStateInPassiveEffects: true,
112+
validateNoJSXInTryStatements: true,
113+
validateNoImpureFunctionsInRender: true,
114+
validateStaticComponents: true,
115+
validateNoFreezingKnownMutableFunctions: true,
110116
}),
111117
};
112118

packages/eslint-plugin-react-hooks/src/rules/ReactCompiler.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,12 @@ const COMPILER_OPTIONS: Partial<PluginOptions> = {
109109
flowSuppressions: false,
110110
environment: validateEnvironmentConfig({
111111
validateRefAccessDuringRender: false,
112+
validateNoSetStateInRender: true,
113+
validateNoSetStateInPassiveEffects: true,
114+
validateNoJSXInTryStatements: true,
115+
validateNoImpureFunctionsInRender: true,
116+
validateStaticComponents: true,
117+
validateNoFreezingKnownMutableFunctions: true,
112118
}),
113119
};
114120

0 commit comments

Comments
 (0)