Browse Source

fix: merge duplicate regex and add missing residual symbols in i18n-remove

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
pull/11767/head
afc163 3 weeks ago
parent
commit
9799b73b04
  1. 8
      scripts/i18n-remove.js

8
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',

Loading…
Cancel
Save