Repository navigation
Expand file tree
/
Copy pathpackage.json
More file actions
329 lines (329 loc) · 11 KB
/
Copy pathpackage.json
File metadata and controls
329 lines (329 loc) · 11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
{
"name": "localization-check",
"displayName": "Localization Check",
"description": "Flags hardcoded user-facing strings in changed JavaScript and TypeScript files",
"version": "0.5.11",
"publisher": "localizationFinder",
"repository": {
"type": "git",
"url": "https://github.com/PramudithaN/localization-check.git"
},
"icon": "images/LF-ico.png",
"license": "MIT",
"engines": {
"vscode": "^1.84.0"
},
"categories": [
"Linters"
],
"activationEvents": [
"onLanguage:javascript",
"onLanguage:javascriptreact",
"onLanguage:typescript",
"onLanguage:typescriptreact",
"onStartupFinished"
],
"main": "./extension.js",
"scripts": {
"test": "mocha test/suite/**/*.test.js",
"check:version": "node scripts/check-version.js"
},
"contributes": {
"commands": [
{
"command": "localizationCheck.run",
"title": "Localization: Run Full Check (git staged)"
},
{
"command": "localizationCheck.scanFile",
"title": "Localization: Re-scan Current File"
},
{
"command": "localizationCheck.findUnusedKeys",
"title": "Localization: Find Unused Translation Keys",
"icon": {
"light": "images/LF-ico.png",
"dark": "images/LF-ico.png"
}
},
{
"command": "localizationCheck.localizeWithCopilot",
"title": "Localization: Add Localization with Copilot",
"icon": {
"light": "images/LF-ico.png",
"dark": "images/LF-ico.png"
}
},
{
"command": "localizationCheck.localizeAllInFile",
"title": "Localization: Localize All in Current File with Copilot",
"icon": {
"light": "images/LF-ico.png",
"dark": "images/LF-ico.png"
}
},
{
"command": "localizationCheck.flagHardcoded",
"title": "Localization: Flag Pattern as Hardcoded Rule (Report & Learn)",
"icon": {
"light": "images/LF-ico.png",
"dark": "images/LF-ico.png"
}
},
{
"command": "localizationCheck.markFalsePositive",
"title": "Localization: Mark / Ignore as False Positive (Report & Learn)",
"icon": {
"light": "images/LF-ico.png",
"dark": "images/LF-ico.png"
}
}
],
"menus": {
"commandPalette": [
{
"command": "localizationCheck.run"
},
{
"command": "localizationCheck.scanFile"
},
{
"command": "localizationCheck.findUnusedKeys"
},
{
"command": "localizationCheck.localizeWithCopilot"
},
{
"command": "localizationCheck.localizeAllInFile"
},
{
"command": "localizationCheck.flagHardcoded"
},
{
"command": "localizationCheck.markFalsePositive"
}
],
"editor/title": [
{
"command": "localizationCheck.localizeAllInFile",
"group": "navigation",
"when": "editorLangId =~ /javascript|javascriptreact|typescript|typescriptreact/"
}
],
"editor/context": [
{
"command": "localizationCheck.localizeWithCopilot",
"group": "1_modification@1",
"when": "editorTextFocus"
},
{
"command": "localizationCheck.localizeAllInFile",
"group": "1_modification@2",
"when": "editorTextFocus"
},
{
"command": "localizationCheck.flagHardcoded",
"group": "1_modification@3",
"when": "editorTextFocus"
},
{
"command": "localizationCheck.markFalsePositive",
"group": "1_modification@4",
"when": "editorTextFocus"
}
]
},
"keybindings": [
{
"command": "localizationCheck.findUnusedKeys",
"key": "alt+u",
"mac": "cmd+alt+u"
},
{
"command": "localizationCheck.localizeWithCopilot",
"key": "alt+l",
"mac": "cmd+alt+l",
"when": "editorTextFocus"
},
{
"command": "localizationCheck.localizeAllInFile",
"key": "alt+shift+l",
"mac": "cmd+alt+shift+l",
"when": "editorTextFocus"
},
{
"command": "localizationCheck.flagHardcoded",
"key": "alt+f",
"mac": "cmd+alt+f",
"when": "editorTextFocus"
},
{
"command": "localizationCheck.markFalsePositive",
"key": "alt+m",
"mac": "cmd+alt+m",
"when": "editorTextFocus"
},
{
"command": "localizationCheck.scanFile",
"key": "alt+s",
"mac": "cmd+alt+s",
"when": "editorTextFocus"
},
{
"command": "localizationCheck.run",
"key": "alt+r",
"mac": "cmd+alt+r"
}
],
"configuration": {
"title": "Localization Check",
"properties": {
"localizationCheck.scriptPath": {
"type": "string",
"default": "scripts/check-localization.js",
"description": "Optional path to a localization check script in the scanned project, relative to the workspace root. Used by the full-check command."
},
"localizationCheck.liveScan": {
"type": "boolean",
"default": true,
"description": "Underline hardcoded strings live as you edit .ts/.tsx/.js/.jsx files."
},
"localizationCheck.diagnosticSeverity": {
"type": "string",
"enum": [
"warning",
"error"
],
"default": "warning",
"description": "Severity used for live diagnostics in the Problems panel. Use 'warning' by default, or 'error' to make unlocalized text show as an error."
},
"localizationCheck.minimumConfidence": {
"type": "string",
"enum": [
"low",
"medium",
"high"
],
"default": "high",
"description": "Minimum confidence level required to flag hardcoded strings. 'high' flags JSX text, standard UI attributes, UI object properties, notification messages, and template strings; 'medium' and 'low' include looser expressions."
},
"localizationCheck.liveScanOnlyChangedFiles": {
"type": "boolean",
"default": true,
"description": "Only show live localization diagnostics for files changed in Git or unsaved editor buffers. Disable this to scan every open file."
},
"localizationCheck.warnOnStage": {
"type": "boolean",
"default": true,
"description": "Show a warning notification when files staged for commit contain hardcoded text that isn't localized. Requires the optional scriptPath script to exist in the scanned project."
},
"localizationCheck.enableCodeLens": {
"type": "boolean",
"default": true,
"description": "Display clickable 'Add localization with Copilot' CodeLens buttons directly above lines containing hardcoded text."
},
"localizationCheck.copilotPromptHint": {
"type": "string",
"default": "",
"description": "Optional custom prompt instructions passed to Copilot when generating localization replacements (e.g., 'Use react-intl formatMessage' or 'Use i18n t()')."
},
"localizationCheck.dictionaryPath": {
"type": "string",
"default": "",
"description": "Optional relative path to primary localization JSON dictionary (e.g., 'src/utils/localization/lang-json/en.json' or 'locales/en.json'). If empty, en.json is auto-discovered."
},
"localizationCheck.autoUpdateDictionary": {
"type": "boolean",
"default": true,
"description": "Automatically insert generated translation keys and English values into en.json when Copilot localizes strings."
},
"localizationCheck.autoImportTranslation": {
"type": "boolean",
"default": true,
"description": "Automatically insert missing i18n imports (e.g. useTranslation) and hook declarations (const { t } = useTranslation()) into the file."
},
"localizationCheck.customAttributes": {
"type": "array",
"items": {
"type": "string"
},
"default": [],
"description": "Additional HTML/JSX attribute names that should be flagged as hardcoded strings (e.g. ['caption', 'headerTitle', 'badgeText'])."
},
"localizationCheck.customProperties": {
"type": "array",
"items": {
"type": "string"
},
"default": [],
"description": "Additional object property names that should be flagged as hardcoded strings (e.g. ['subTitle', 'heading', 'bannerText'])."
},
"localizationCheck.customWords": {
"type": "array",
"items": {
"type": "string"
},
"default": [],
"description": "Specific words, phrases, or string literals to explicitly flag as hardcoded across the workspace (e.g. ['Submit', 'Update', 'Save'])."
},
"localizationCheck.customTags": {
"type": "array",
"items": {
"type": "string"
},
"default": [],
"description": "Additional JSX/HTML component/tag names whose inner text should be flagged as hardcoded (e.g. ['Typography', 'Badge', 'Alert'])."
},
"localizationCheck.ignoredWords": {
"type": "array",
"items": {
"type": "string"
},
"default": [],
"description": "Specific words, phrases, or technical literals that should never be flagged as hardcoded strings."
},
"localizationCheck.ignoredAttributes": {
"type": "array",
"items": {
"type": "string"
},
"default": [],
"description": "Attribute names to ignore and never flag (e.g. ['data-testid', 'className'])."
},
"localizationCheck.ignoredProperties": {
"type": "array",
"items": {
"type": "string"
},
"default": [],
"description": "Object property names to ignore and never flag (e.g. ['id', 'key', 'status'])."
},
"localizationCheck.ignoredTags": {
"type": "array",
"items": {
"type": "string"
},
"default": [
"code",
"pre",
"script",
"style"
],
"description": "JSX/HTML tag names whose inner text should be ignored (e.g. ['code', 'pre'])."
},
"localizationCheck.githubRepo": {
"type": "string",
"default": "PramudithaN/localization-check",
"description": "GitHub repository (owner/repo) where flagged rules and false positives are submitted as issues."
}
}
}
},
"dependencies": {
"@babel/parser": "^7.24.0",
"@babel/traverse": "^7.24.0"
},
"devDependencies": {
"mocha": "^12.0.2"
}
}