Skip to content

Commit 0d39496

Browse files
authored
[compiler] Enable additional lints by default (#33752)
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. --- [//]: # (BEGIN SAPLING FOOTER) Stack created with [Sapling](https://sapling-scm.com). Best reviewed with [ReviewStack](https://reviewstack.dev/facebook/react/pull/33752). * #33981 * #33777 * #33767 * #33765 * #33760 * #33759 * #33758 * #33751 * __->__ #33752 * #33753
1 parent 6f4294a commit 0d39496

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+
validateNoSetStateInEffects: 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+
validateNoSetStateInEffects: true,
114+
validateNoJSXInTryStatements: true,
115+
validateNoImpureFunctionsInRender: true,
116+
validateStaticComponents: true,
117+
validateNoFreezingKnownMutableFunctions: true,
112118
}),
113119
};
114120

0 commit comments

Comments
 (0)