From 1d17066ffcb7e65c845a34142c6b0a404d06dda1 Mon Sep 17 00:00:00 2001 From: Lauren Tan Date: Mon, 28 Jul 2025 13:26:00 -0400 Subject: [PATCH] [compiler] Enable validateNoVoidUseMemo in eslint & playground Enables `validateNoVoidUseMemo` by default only in eslint (it defaults to false otherwise) as well as the playground. --- compiler/apps/playground/components/Editor/EditorImpl.tsx | 1 + .../eslint-plugin-react-compiler/src/rules/ReactCompilerRule.ts | 1 + packages/eslint-plugin-react-hooks/src/rules/ReactCompiler.ts | 1 + 3 files changed, 3 insertions(+) diff --git a/compiler/apps/playground/components/Editor/EditorImpl.tsx b/compiler/apps/playground/components/Editor/EditorImpl.tsx index 0ced1e54ed7..2a8697157a3 100644 --- a/compiler/apps/playground/components/Editor/EditorImpl.tsx +++ b/compiler/apps/playground/components/Editor/EditorImpl.tsx @@ -219,6 +219,7 @@ function compile( validateNoImpureFunctionsInRender: true, validateStaticComponents: true, validateNoFreezingKnownMutableFunctions: true, + validateNoVoidUseMemo: true, } : { /* use defaults for compiler mode */ diff --git a/compiler/packages/eslint-plugin-react-compiler/src/rules/ReactCompilerRule.ts b/compiler/packages/eslint-plugin-react-compiler/src/rules/ReactCompilerRule.ts index 1d326012864..618d3b78b9d 100644 --- a/compiler/packages/eslint-plugin-react-compiler/src/rules/ReactCompilerRule.ts +++ b/compiler/packages/eslint-plugin-react-compiler/src/rules/ReactCompilerRule.ts @@ -108,6 +108,7 @@ const COMPILER_OPTIONS: Partial = { validateNoImpureFunctionsInRender: true, validateStaticComponents: true, validateNoFreezingKnownMutableFunctions: true, + validateNoVoidUseMemo: true, }), }; diff --git a/packages/eslint-plugin-react-hooks/src/rules/ReactCompiler.ts b/packages/eslint-plugin-react-hooks/src/rules/ReactCompiler.ts index 0492c2c30c3..8961561ef96 100644 --- a/packages/eslint-plugin-react-hooks/src/rules/ReactCompiler.ts +++ b/packages/eslint-plugin-react-hooks/src/rules/ReactCompiler.ts @@ -110,6 +110,7 @@ const COMPILER_OPTIONS: Partial = { validateNoImpureFunctionsInRender: true, validateStaticComponents: true, validateNoFreezingKnownMutableFunctions: true, + validateNoVoidUseMemo: true, }), };