Skip to content

Commit b544b15

Browse files
committed
[compiler] Enable validateNoVoidUseMemo in eslint
Enables `validateNoVoidUseMemo` by default only in eslint (it defaults to false otherwise). Renamed the flag for consistency with the rest of our other validation flags.
1 parent 7872b2e commit b544b15

File tree

4 files changed

+4
-2
lines changed

4 files changed

+4
-2
lines changed

compiler/packages/babel-plugin-react-compiler/src/HIR/Environment.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -641,7 +641,7 @@ export const EnvironmentConfigSchema = z.object({
641641
* Invalid:
642642
* useMemo(() => { ... }, [...]);
643643
*/
644-
enableValidateNoVoidUseMemo: z.boolean().default(false),
644+
validateNoVoidUseMemo: z.boolean().default(false),
645645
});
646646

647647
export type EnvironmentConfig = z.infer<typeof EnvironmentConfigSchema>;

compiler/packages/babel-plugin-react-compiler/src/Inference/DropManualMemoization.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ export function dropManualMemoization(
448448
* values.
449449
*/
450450
if (
451-
func.env.config.enableValidateNoVoidUseMemo &&
451+
func.env.config.validateNoVoidUseMemo &&
452452
manualMemo.kind === 'useMemo'
453453
) {
454454
const funcToCheck = sidemap.functions.get(

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ const COMPILER_OPTIONS: Partial<PluginOptions> = {
108108
validateNoImpureFunctionsInRender: true,
109109
validateStaticComponents: true,
110110
validateNoFreezingKnownMutableFunctions: true,
111+
validateNoVoidUseMemo: true,
111112
}),
112113
};
113114

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ const COMPILER_OPTIONS: Partial<PluginOptions> = {
110110
validateNoImpureFunctionsInRender: true,
111111
validateStaticComponents: true,
112112
validateNoFreezingKnownMutableFunctions: true,
113+
validateNoVoidUseMemo: true,
113114
}),
114115
};
115116

0 commit comments

Comments
 (0)