Skip to content

Commit 959ab3b

Browse files
christian-byrnegithub-actions
andauthored
[feat] Add ESLint i18n enforcement and fix hardcoded strings (#4327)
Co-authored-by: github-actions <[email protected]>
1 parent 35ff882 commit 959ab3b

File tree

17 files changed

+394
-157
lines changed

17 files changed

+394
-157
lines changed

eslint.config.js

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import pluginJs from '@eslint/js'
2+
import pluginI18n from '@intlify/eslint-plugin-vue-i18n'
23
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended'
34
import unusedImports from 'eslint-plugin-unused-imports'
45
import pluginVue from 'eslint-plugin-vue'
@@ -45,15 +46,50 @@ export default [
4546
},
4647
{
4748
plugins: {
48-
'unused-imports': unusedImports
49+
'unused-imports': unusedImports,
50+
'@intlify/vue-i18n': pluginI18n
4951
},
5052
rules: {
5153
'@typescript-eslint/no-floating-promises': 'error',
5254
'@typescript-eslint/no-explicit-any': 'off',
5355
'@typescript-eslint/no-unused-vars': 'off',
5456
'@typescript-eslint/prefer-as-const': 'off',
5557
'unused-imports/no-unused-imports': 'error',
56-
'vue/no-v-html': 'off'
58+
'vue/no-v-html': 'off',
59+
// i18n rules
60+
'@intlify/vue-i18n/no-raw-text': [
61+
'error',
62+
{
63+
// Ignore strings that are:
64+
// 1. Less than 2 characters
65+
// 2. Only symbols/numbers/whitespace (no letters)
66+
// 3. Match specific patterns
67+
ignorePattern:
68+
'^[^a-zA-Z]*$|^.{0,1}$|^[\\w._%+-]+@[\\w.-]+\\.[A-Za-z]{2,}$',
69+
ignoreNodes: ['md-icon', 'v-icon', 'pre', 'code', 'script', 'style'],
70+
// Brand names and technical terms that shouldn't be translated
71+
ignoreText: [
72+
'ComfyUI',
73+
'GitHub',
74+
'OpenAI',
75+
'API',
76+
'URL',
77+
'JSON',
78+
'YAML',
79+
'GPU',
80+
'CPU',
81+
'RAM',
82+
'GB',
83+
'MB',
84+
'KB',
85+
'ms',
86+
'fps',
87+
'px',
88+
'App Data:',
89+
'App Path:'
90+
]
91+
}
92+
]
5793
}
5894
}
5995
]

0 commit comments

Comments
 (0)