@samitouri / QOS-React / commits / 0d39496eab

[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

Joseph Savona committed Jul 24, 2025 at 15:36 UTC 0d39496eab710b5a3efc07d34c0db3f2475c04f8
2 files changed +12
compiler/packages/eslint-plugin-react-compiler/src/rules/ReactCompilerRule.ts
+6
@@ -107,6 +107,12 @@ const COMPILER_OPTIONS: Partial<PluginOptions> = {
107 flowSuppressions: false,
108 environment: validateEnvironmentConfig({
109 validateRefAccessDuringRender: false,
110 + validateNoSetStateInRender: true,
111 + validateNoSetStateInEffects: true,
112 + validateNoJSXInTryStatements: true,
113 + validateNoImpureFunctionsInRender: true,
114 + validateStaticComponents: true,
115 + validateNoFreezingKnownMutableFunctions: true,
116 }),
117 };
118
packages/eslint-plugin-react-hooks/src/rules/ReactCompiler.ts
+6
@@ -109,6 +109,12 @@ const COMPILER_OPTIONS: Partial<PluginOptions> = {
109 flowSuppressions: false,
110 environment: validateEnvironmentConfig({
111 validateRefAccessDuringRender: false,
112 + validateNoSetStateInRender: true,
113 + validateNoSetStateInEffects: true,
114 + validateNoJSXInTryStatements: true,
115 + validateNoImpureFunctionsInRender: true,
116 + validateStaticComponents: true,
117 + validateNoFreezingKnownMutableFunctions: true,
118 }),
119 };
120