-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpackage.json
More file actions
332 lines (332 loc) · 14.1 KB
/
package.json
File metadata and controls
332 lines (332 loc) · 14.1 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
330
331
332
{
"name": "mini-typescript-hero",
"displayName": "Mini TypeScript Hero",
"description": "Sorts and organizes TypeScript/JavaScript imports — Keep your codebase clean with custom import grouping, automatic cleanup, and smart formatting. Small hero. Big cleanup!",
"version": "4.0.1",
"publisher": "angular-schule",
"icon": "icon.png",
"galleryBanner": {
"color": "#ffffff",
"theme": "light"
},
"author": {
"name": "Johannes Hoppe",
"email": "team@angular.schule",
"url": "https://angular.schule"
},
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/angular-schule/mini-typescript-hero"
},
"homepage": "https://github.com/angular-schule/mini-typescript-hero",
"bugs": {
"url": "https://github.com/angular-schule/mini-typescript-hero/issues"
},
"keywords": [
"typescript",
"javascript",
"imports",
"organize",
"sort",
"formatter"
],
"engines": {
"vscode": "^1.104.0",
"node": ">=18.0.0"
},
"categories": [
"Formatters",
"Programming Languages"
],
"activationEvents": [
"onLanguage:typescript",
"onLanguage:typescriptreact",
"onLanguage:javascript",
"onLanguage:javascriptreact"
],
"main": "./dist/extension.js",
"contributes": {
"commands": [
{
"command": "miniTypescriptHero.imports.organize",
"title": "Mini TS Hero: Organize imports (sort and remove unused)"
},
{
"command": "miniTypescriptHero.imports.organizeWorkspace",
"title": "Mini TS Hero: Organize imports in workspace",
"description": "Organize imports in all TypeScript and JavaScript files (.ts, .tsx, .js, .jsx) in the workspace"
},
{
"command": "miniTypescriptHero.imports.organizeFolder",
"title": "Mini TS Hero: Organize imports in folder",
"description": "Organize imports in all TypeScript and JavaScript files (.ts, .tsx, .js, .jsx) in the selected folder"
},
{
"command": "miniTypescriptHero.checkConflicts",
"title": "Mini TS Hero: Check for configuration conflicts"
},
{
"command": "miniTypescriptHero.toggleLegacyMode",
"title": "Mini TS Hero: Toggle legacy mode"
}
],
"menus": {
"explorer/context": [
{
"command": "miniTypescriptHero.imports.organizeFolder",
"when": "explorerResourceIsFolder",
"group": "1_modification"
}
],
"commandPalette": [
{
"command": "miniTypescriptHero.imports.organizeFolder",
"when": "false"
}
]
},
"keybindings": [
{
"command": "miniTypescriptHero.imports.organize",
"key": "ctrl+alt+o",
"when": "editorTextFocus && editorLangId =~ /^(typescript|typescriptreact|javascript|javascriptreact)$/ && !editorReadonly"
},
{
"command": "miniTypescriptHero.imports.organize",
"key": "cmd+alt+o",
"mac": "cmd+alt+o",
"when": "editorTextFocus && editorLangId =~ /^(typescript|typescriptreact|javascript|javascriptreact)$/ && !editorReadonly"
}
],
"configuration": {
"title": "Mini TypeScript Hero",
"properties": {
"miniTypescriptHero.imports.insertSpaceBeforeAndAfterImportBraces": {
"type": "boolean",
"default": true,
"description": "Defines if there should be a space inside the curly braces of an import statement.",
"scope": "resource"
},
"miniTypescriptHero.imports.removeTrailingIndex": {
"type": "boolean",
"default": true,
"description": "Defines if a trailing '/index' should be removed from imports.",
"scope": "resource"
},
"miniTypescriptHero.imports.insertSemicolons": {
"type": "boolean",
"default": true,
"description": "Defines if there should be a semicolon at the end of a statement. Fallback setting - respects VSCode 'typescript.format.semicolons' and 'javascript.format.semicolons' first.",
"scope": "resource"
},
"miniTypescriptHero.imports.stringQuoteStyle": {
"enum": [
"'",
"\""
],
"default": "'",
"description": "Defines if single or double quotes should be used. Fallback setting - respects VSCode 'typescript.preferences.quoteStyle' and 'javascript.preferences.quoteStyle' first.",
"scope": "resource"
},
"miniTypescriptHero.imports.multiLineWrapThreshold": {
"type": "number",
"minimum": 1,
"multipleOf": 1,
"default": 125,
"description": "Defines the threshold when an import should be wrapped into a multiline import.",
"scope": "resource"
},
"miniTypescriptHero.imports.multiLineTrailingComma": {
"type": "boolean",
"default": true,
"description": "Defines if multiline imports contain the last trailing comma.",
"scope": "resource"
},
"miniTypescriptHero.imports.organizeOnSave": {
"type": "boolean",
"default": false,
"description": "Defines if the imports should be organized on save.",
"scope": "resource"
},
"miniTypescriptHero.imports.organizeSortsByFirstSpecifier": {
"type": "boolean",
"default": false,
"description": "Defines if the imports are organized by first specifier/alias instead of module path. NOTE: This setting has no effect when disableImportsSorting is true (sorting is disabled) or when legacyMode is true (legacy mode always sorts by library name).",
"scope": "resource"
},
"miniTypescriptHero.imports.disableImportsSorting": {
"type": "boolean",
"default": false,
"description": "Defines if sorting is disabled during organize imports. NOTE: This setting has no effect when legacyMode is true (legacy mode always sorts within groups).",
"scope": "resource"
},
"miniTypescriptHero.imports.disableImportRemovalOnOrganize": {
"type": "boolean",
"default": false,
"description": "Defines if any imports should be removed at all on an organize imports command.",
"scope": "resource"
},
"miniTypescriptHero.imports.mergeImportsFromSameModule": {
"type": "boolean",
"default": true,
"description": "Merge multiple import statements from the same module into a single import. For example, 'import { A } from \"./lib\"' and 'import { B } from \"./lib\"' become 'import { A, B } from \"./lib\"'. This setting is independent from removal behavior.",
"scope": "resource"
},
"miniTypescriptHero.imports.excludePatterns": {
"type": "array",
"items": {
"type": "string"
},
"uniqueItems": true,
"default": [],
"markdownDescription": "Additional glob patterns for files to exclude from import organization (workspace and single-file operations). These patterns are added to the built-in defaults: `**/node_modules/**`, `**/dist/**`, `**/build/**`, `**/out/**`, `**/.git/**`, `**/coverage/**`.\n\nCommon examples:\n- `**/.next/**` (Next.js build output)\n- `**/.nuxt/**` (Nuxt build output)\n- `**/tmp/**` (temporary files)\n- `**/generated/**` (auto-generated code)\n\n**Team collaboration:** When organizing a single file that matches an exclude pattern, a warning is shown to inform the user.",
"scope": "resource"
},
"miniTypescriptHero.imports.ignoredFromRemoval": {
"type": "array",
"items": {
"type": "string"
},
"uniqueItems": true,
"default": [
"react"
],
"description": "Defines imports (libraries, so the 'from' part), which are not removed during 'organize imports'.",
"scope": "resource"
},
"miniTypescriptHero.imports.legacyMode": {
"type": "boolean",
"default": false,
"description": "Enable full legacy mode for formatting compatibility with old TypeScript Hero extension (with documented exceptions for crashes and edge cases). When true: replicates old formatting behaviors (within-group sorting bug, preserve blank lines, merge-before-removeTrailingIndex timing, type-only merge). When false: modern best practices (correct sorting, 1 blank line, correct merge timing, type-only separation). Migrated users get 'true' automatically.",
"scope": "resource"
},
"miniTypescriptHero.imports.tabSize": {
"type": "number",
"minimum": 1,
"default": 2,
"markdownDescription": "**Only used when `useOnlyExtensionSettings` is true.** Otherwise, VS Code `editor.tabSize` is always used.\n\n**VS Code always has a value** for `editor.tabSize` (default: 4 spaces). Modern mode overrides this to 2 spaces when VS Code is at its default value.\n\n**Note:** VS Code automatically reads `editor.tabSize` from `.editorconfig` files (if EditorConfig extension is installed). We read the final resolved value, so EditorConfig integration works automatically.",
"scope": "resource"
},
"miniTypescriptHero.imports.insertSpaces": {
"type": "boolean",
"default": true,
"markdownDescription": "**Only used when `useOnlyExtensionSettings` is true.** Otherwise, VS Code `editor.insertSpaces` is always used.\n\n**VS Code always has a value** for `editor.insertSpaces` (default: true).\n\n**Note:** VS Code automatically reads `editor.insertSpaces` from `.editorconfig` files (if EditorConfig extension is installed). We read the final resolved value, so EditorConfig integration works automatically.",
"scope": "resource"
},
"miniTypescriptHero.imports.useOnlyExtensionSettings": {
"type": "boolean",
"default": false,
"markdownDescription": "When enabled, ignores VS Code settings and uses only Mini TypeScript Hero extension settings for all formatting options (quotes, semicolons, indentation).\n\n**Use case:** Enforce consistent import formatting across all team members regardless of their editor configuration.",
"scope": "resource"
},
"miniTypescriptHero.imports.blankLinesAfterImports": {
"enum": [
"one",
"two",
"preserve"
],
"default": "one",
"description": "Number of blank lines after the last import before code starts. 'one' = exactly 1 (Google/ESLint/Prettier standard), 'two' = exactly 2, 'preserve' = keep existing blank lines. NOTE: This setting has no effect when legacyMode is true (legacy mode always uses 'preserve' behavior).",
"scope": "resource"
},
"miniTypescriptHero.imports.grouping": {
"type": "array",
"items": {
"anyOf": [
{
"enum": [
"Modules",
"Plains",
"Workspace",
"Remaining"
]
},
{
"type": "string",
"pattern": "^/.+/[dgimsuyv]*$",
"description": "Regex pattern for custom grouping (e.g., '/^@angular/', '/rxjs/', etc.)"
},
{
"type": "object",
"properties": {
"identifier": {
"anyOf": [
{
"enum": [
"Modules",
"Plains",
"Workspace",
"Remaining"
]
},
{
"type": "string",
"pattern": "^/.+/[dgimsuyv]*$",
"description": "Regex pattern (e.g., '/^@angular/')"
}
]
},
"order": {
"enum": [
"asc",
"desc"
]
}
},
"additionalProperties": false,
"required": [
"identifier",
"order"
]
}
]
},
"default": [
"Plains",
"Modules",
"Workspace"
],
"description": "Defines the groups of imports and their order. Possible values are \"Modules\" (for library imports), \"Plains\" (for string-only imports), \"Workspace\" (for local imports), \"Remaining\" (catch-all) or a regex pattern (enclosed in forward slashes). You can also specify an object with \"identifier\" and \"order\" (asc/desc).",
"scope": "resource"
}
}
}
},
"scripts": {
"vscode:prepublish": "npm run package",
"compile": "npm run check-types && npm run lint && node esbuild.js",
"watch": "npm-run-all -p watch:*",
"watch:esbuild": "node esbuild.js --watch",
"watch:tsc": "tsc --noEmit --watch --project tsconfig.json",
"package": "npm run check-types && npm run lint && node esbuild.js --production",
"compile-tests": "tsc -p . --outDir out",
"watch-tests": "tsc -p . -w --outDir out",
"clean": "rm -rf out",
"pretest": "npm run clean && npm run compile-tests && node esbuild.js && npm run lint",
"check-types": "tsc --noEmit",
"lint": "eslint \"src/**/*.ts\"",
"test": "vscode-test",
"test:comparison": "cd tests/comparison && npm test",
"test:all": "npm test && npm run test:comparison",
"vsix": "vsce package"
},
"devDependencies": {
"@types/mocha": "^10.0.10",
"@types/node": "22.x",
"@types/vscode": "^1.104.0",
"@typescript-eslint/eslint-plugin": "^8.45.0",
"@typescript-eslint/parser": "^8.45.0",
"@vscode/test-cli": "^0.0.11",
"@vscode/test-electron": "^2.5.2",
"@vscode/vsce": "^3.7.1",
"esbuild": "^0.25.10",
"eslint": "^9.36.0",
"npm-run-all": "^4.1.5",
"typescript": "^5.9.3"
},
"dependencies": {
"minimatch": "^10.1.1",
"ts-morph": "^27.0.0"
}
}