From 9799b73b04550be9f136ea7ad8474339ccf3ccea Mon Sep 17 00:00:00 2001 From: afc163 Date: Wed, 6 May 2026 23:31:42 +0800 Subject: [PATCH] fix: merge duplicate regex and add missing residual symbols in i18n-remove Co-Authored-By: Claude Opus 4.7 --- scripts/i18n-remove.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/scripts/i18n-remove.js b/scripts/i18n-remove.js index 74a58581..8b06f0a0 100644 --- a/scripts/i18n-remove.js +++ b/scripts/i18n-remove.js @@ -264,11 +264,7 @@ function processFile(filePath, localeMap) { // 只在文件中不再有其他 intl. 引用时移除 if (!content.match(/\bintl\./)) { content = content.replace( - /\n\s*\/\*\*[\s\S]*?\*\/\n\s*const\s+intl\s*=\s*(?:useIntl|getIntl)\(\)\s*;?\n/g, - '\n', - ); - content = content.replace( - /\n\s*const\s+intl\s*=\s*(?:useIntl|getIntl)\(\)\s*;?\n/g, + /\n\s*(?:\/\*\*[\s\S]*?\*\/\n\s*)?const\s+intl\s*=\s*(?:useIntl|getIntl)\(\)\s*;?\n/g, '\n', ); } @@ -507,7 +503,9 @@ function deleteLocalesDir() { function checkResiduals() { const residualSymbols = [ + 'useIntl', 'getIntl', + 'FormattedMessage', 'getLocale', 'getAllLocales', 'setLocale',