From 8d7d13a5f123c80ccc4967532d9edba7992176b1 Mon Sep 17 00:00:00 2001 From: MorikawaSouma Date: Mon, 16 Mar 2026 21:41:48 +0800 Subject: [PATCH 1/2] fix(compiler): preserve HTML entities in JSX text by correctly detecting non-empty lines --- .../packages/babel-plugin-react-compiler/src/HIR/BuildHIR.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/packages/babel-plugin-react-compiler/src/HIR/BuildHIR.ts b/compiler/packages/babel-plugin-react-compiler/src/HIR/BuildHIR.ts index 8f44594c0031..43d2cb471ad2 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/HIR/BuildHIR.ts +++ b/compiler/packages/babel-plugin-react-compiler/src/HIR/BuildHIR.ts @@ -3563,7 +3563,7 @@ function trimJsxText(original: string): string | null { let lastNonEmptyLine = 0; for (let i = 0; i < lines.length; i++) { - if (lines[i].match(/[^ \t]/)) { + if (lines[i].trim().length > 0) { lastNonEmptyLine = i; } } From 44c7c5cb465cd25cb91495d699a868bc03e7eb8c Mon Sep 17 00:00:00 2001 From: MorikawaSouma Date: Mon, 16 Mar 2026 22:18:20 +0800 Subject: [PATCH 2/2] fix(eslint-plugin-react-hooks): fix TypeScript types for flat config --- .../eslint-plugin-react-hooks/src/index.ts | 54 +++++++++---------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/packages/eslint-plugin-react-hooks/src/index.ts b/packages/eslint-plugin-react-hooks/src/index.ts index 924299d89894..f2e28208a651 100644 --- a/packages/eslint-plugin-react-hooks/src/index.ts +++ b/packages/eslint-plugin-react-hooks/src/index.ts @@ -58,43 +58,43 @@ const recommendedLatestRuleConfigs: Linter.RulesRecord = { const plugins = ['react-hooks']; type ReactHooksFlatConfig = { - plugins: {react: any}; + plugins: {'react-hooks': typeof plugin}; rules: Linter.RulesRecord; }; -const configs = { - recommended: { - plugins, - rules: recommendedRuleConfigs, - }, - 'recommended-latest': { - plugins, - rules: recommendedLatestRuleConfigs, - }, - flat: {} as { - recommended: ReactHooksFlatConfig; - 'recommended-latest': ReactHooksFlatConfig; - }, -}; - const plugin = { meta: { name: 'eslint-plugin-react-hooks', version: '7.0.0', }, rules, - configs, + configs: { + recommended: { + plugins, + rules: recommendedRuleConfigs, + }, + 'recommended-latest': { + plugins, + rules: recommendedLatestRuleConfigs, + }, + flat: { + recommended: { + plugins: {'react-hooks': null as unknown as typeof plugin}, + rules: recommendedRuleConfigs, + }, + 'recommended-latest': { + plugins: {'react-hooks': null as unknown as typeof plugin}, + rules: recommendedLatestRuleConfigs, + }, + } as { + recommended: ReactHooksFlatConfig; + 'recommended-latest': ReactHooksFlatConfig; + }, + }, }; -Object.assign(configs.flat, { - 'recommended-latest': { - plugins: {'react-hooks': plugin}, - rules: configs['recommended-latest'].rules, - }, - recommended: { - plugins: {'react-hooks': plugin}, - rules: configs.recommended.rules, - }, -}); +// Assign the plugin reference after plugin object is created +plugin.configs.flat.recommended.plugins['react-hooks'] = plugin; +plugin.configs.flat['recommended-latest'].plugins['react-hooks'] = plugin; export default plugin;