vize 0.429.1 → 0.430.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/cli.mjs +30 -3
- package/dist/cli.mjs.map +1 -1
- package/dist/{config-BQtBhO5c.d.mts → config-GxBRbNGY.d.mts} +59 -2
- package/dist/config-GxBRbNGY.d.mts.map +1 -0
- package/dist/config.d.mts +1 -1
- package/dist/index.d.mts +1 -1
- package/package.json +2 -2
- package/pkl/FormatterConfig.pkl +4 -0
- package/pkl/LinterConfig.pkl +27 -0
- package/pkl/SortImportsConfig.pkl +27 -0
- package/pkl/TypeCheckerConfig.pkl +3 -0
- package/pkl/jsonschema/ConfigArtifactDefinitions.pkl +2 -16
- package/pkl/jsonschema/FormatterSchemaDefinitions.pkl +124 -0
- package/pkl/jsonschema/ImportSortSchemaDefinitions.pkl +56 -0
- package/pkl/jsonschema/LintRuleOptionsSchemaDefinitions.pkl +38 -0
- package/pkl/jsonschema/LinterSchemaDefinitions.pkl +74 -0
- package/pkl/jsonschema/generate.pkl +8 -174
- package/pkl/vize.pkl +47 -0
- package/schemas/vize.config.schema.json +164 -0
- package/src/init/detect.ts +17 -0
- package/src/init/plan-project.ts +8 -2
- package/src/init/templates.ts +13 -1
- package/src/types/generated.ts +61 -0
- package/src/types/index.ts +2 -0
- package/src/types/rules.ts +1 -0
- package/dist/config-BQtBhO5c.d.mts.map +0 -1
|
@@ -1,17 +1,11 @@
|
|
|
1
1
|
/// Generates secondary JSON Schema compatibility output from the primary Pkl definitions.
|
|
2
|
-
/// Usage: pkl eval -f json pkl/jsonschema/generate.pkl
|
|
3
2
|
module vize.jsonschema.generate
|
|
4
3
|
import "@json_schema/JsonSchema.pkl"
|
|
5
4
|
import "ConfigArtifactDefinitions.pkl"
|
|
6
5
|
import "MuseaSchemaDefinitions.pkl"
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
local lintPresetEnum: JsonSchema = new JsonSchema {
|
|
12
|
-
type = "string"
|
|
13
|
-
enum = new Listing { "happy-path"; "opinionated"; "essential"; "incremental"; "ecosystem"; "nuxt" }
|
|
14
|
-
}
|
|
6
|
+
import "LinterSchemaDefinitions.pkl"
|
|
7
|
+
import "FormatterSchemaDefinitions.pkl"
|
|
8
|
+
import "ImportSortSchemaDefinitions.pkl"
|
|
15
9
|
local stringListDef: JsonSchema = new JsonSchema {
|
|
16
10
|
type = "array"
|
|
17
11
|
items = new JsonSchema { type = "string" }
|
|
@@ -59,49 +53,6 @@ local vitePluginConfigDef: JsonSchema = new JsonSchema {
|
|
|
59
53
|
}
|
|
60
54
|
additionalProperties = false
|
|
61
55
|
}
|
|
62
|
-
local linterConfigDef: JsonSchema = new JsonSchema {
|
|
63
|
-
type = "object"
|
|
64
|
-
description = "Linter options"
|
|
65
|
-
properties {
|
|
66
|
-
["enabled"] = new JsonSchema {
|
|
67
|
-
type = "boolean"
|
|
68
|
-
description = "Enable linting"
|
|
69
|
-
}
|
|
70
|
-
["preset"] = new JsonSchema {
|
|
71
|
-
type = lintPresetEnum.type
|
|
72
|
-
enum = lintPresetEnum.enum
|
|
73
|
-
description = "Built-in lint preset"
|
|
74
|
-
default = "happy-path"
|
|
75
|
-
}
|
|
76
|
-
["typeAware"] = new JsonSchema {
|
|
77
|
-
type = "boolean"
|
|
78
|
-
description = "Enable native type-aware lint rules from the active lint configuration"
|
|
79
|
-
}
|
|
80
|
-
["rules"] = new JsonSchema {
|
|
81
|
-
type = "object"
|
|
82
|
-
description = "Rules to enable/disable"
|
|
83
|
-
additionalProperties = ruleSeverityEnum
|
|
84
|
-
}
|
|
85
|
-
["ruleOptions"] = new JsonSchema {
|
|
86
|
-
`$ref` = "#/definitions/LintRuleOptions"
|
|
87
|
-
}
|
|
88
|
-
["categories"] = new JsonSchema {
|
|
89
|
-
type = "object"
|
|
90
|
-
description = "Category-level severity overrides"
|
|
91
|
-
properties {
|
|
92
|
-
["correctness"] = ruleSeverityEnum
|
|
93
|
-
["suspicious"] = ruleSeverityEnum
|
|
94
|
-
["style"] = ruleSeverityEnum
|
|
95
|
-
["perf"] = ruleSeverityEnum
|
|
96
|
-
["a11y"] = ruleSeverityEnum
|
|
97
|
-
["security"] = ruleSeverityEnum
|
|
98
|
-
}
|
|
99
|
-
additionalProperties = false
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
additionalProperties = false
|
|
103
|
-
}
|
|
104
|
-
|
|
105
56
|
local typeCheckerConfigDef: JsonSchema = new JsonSchema {
|
|
106
57
|
type = "object"
|
|
107
58
|
properties {
|
|
@@ -185,129 +136,10 @@ local typeCheckerConfigDef: JsonSchema = new JsonSchema {
|
|
|
185
136
|
type = "integer"
|
|
186
137
|
description = "Reserved Corsa server count. The direct project-session runner currently supports only 1."
|
|
187
138
|
}
|
|
139
|
+
["lspRequestTimeoutMs"] = new JsonSchema { type = "integer"; description = "Hard bound in milliseconds for each editor Corsa request. Defaults to 60000; use a larger value for large cold projects."; minimum = 1 }
|
|
188
140
|
}
|
|
189
141
|
additionalProperties = false
|
|
190
142
|
}
|
|
191
|
-
local formatterConfigDef: JsonSchema = new JsonSchema {
|
|
192
|
-
type = "object"
|
|
193
|
-
description = "Formatter options"
|
|
194
|
-
properties {
|
|
195
|
-
["printWidth"] = new JsonSchema {
|
|
196
|
-
type = "integer"
|
|
197
|
-
description = "Max line width"
|
|
198
|
-
default = 100
|
|
199
|
-
}
|
|
200
|
-
["tabWidth"] = new JsonSchema {
|
|
201
|
-
type = "integer"
|
|
202
|
-
description = "Indentation width"
|
|
203
|
-
default = 2
|
|
204
|
-
}
|
|
205
|
-
["useTabs"] = new JsonSchema {
|
|
206
|
-
type = "boolean"
|
|
207
|
-
description = "Use tabs for indentation"
|
|
208
|
-
default = false
|
|
209
|
-
}
|
|
210
|
-
["semi"] = new JsonSchema {
|
|
211
|
-
type = "boolean"
|
|
212
|
-
description = "Print semicolons"
|
|
213
|
-
default = true
|
|
214
|
-
}
|
|
215
|
-
["singleQuote"] = new JsonSchema {
|
|
216
|
-
type = "boolean"
|
|
217
|
-
description = "Use single quotes"
|
|
218
|
-
default = false
|
|
219
|
-
}
|
|
220
|
-
["jsxSingleQuote"] = new JsonSchema {
|
|
221
|
-
type = "boolean"
|
|
222
|
-
description = "Use single quotes in JSX"
|
|
223
|
-
default = false
|
|
224
|
-
}
|
|
225
|
-
["trailingComma"] = new JsonSchema {
|
|
226
|
-
type = "string"
|
|
227
|
-
enum = new Listing { "all"; "none"; "es5" }
|
|
228
|
-
description = "Trailing commas"
|
|
229
|
-
default = "all"
|
|
230
|
-
}
|
|
231
|
-
["bracketSpacing"] = new JsonSchema {
|
|
232
|
-
type = "boolean"
|
|
233
|
-
description = "Print spaces between brackets in object literals"
|
|
234
|
-
default = true
|
|
235
|
-
}
|
|
236
|
-
["bracketSameLine"] = new JsonSchema {
|
|
237
|
-
type = "boolean"
|
|
238
|
-
description = "Keep > on the last line of multiline tags"
|
|
239
|
-
default = false
|
|
240
|
-
}
|
|
241
|
-
["arrowParens"] = new JsonSchema {
|
|
242
|
-
type = "string"
|
|
243
|
-
enum = new Listing { "always"; "avoid" }
|
|
244
|
-
description = "Arrow parens mode"
|
|
245
|
-
default = "always"
|
|
246
|
-
}
|
|
247
|
-
["endOfLine"] = new JsonSchema {
|
|
248
|
-
type = "string"
|
|
249
|
-
enum = new Listing { "lf"; "crlf"; "cr"; "auto" }
|
|
250
|
-
description = "End-of-line mode"
|
|
251
|
-
default = "lf"
|
|
252
|
-
}
|
|
253
|
-
["quoteProps"] = new JsonSchema {
|
|
254
|
-
type = "string"
|
|
255
|
-
enum = new Listing { "as-needed"; "consistent"; "preserve" }
|
|
256
|
-
description = "Object property quoting mode"
|
|
257
|
-
default = "as-needed"
|
|
258
|
-
}
|
|
259
|
-
["singleAttributePerLine"] = new JsonSchema {
|
|
260
|
-
type = "boolean"
|
|
261
|
-
description = "Force one attribute per line"
|
|
262
|
-
default = false
|
|
263
|
-
}
|
|
264
|
-
["vueIndentScriptAndStyle"] = new JsonSchema {
|
|
265
|
-
type = "boolean"
|
|
266
|
-
description = "Indent script and style blocks"
|
|
267
|
-
default = false
|
|
268
|
-
}
|
|
269
|
-
["sortAttributes"] = new JsonSchema {
|
|
270
|
-
type = "boolean"
|
|
271
|
-
description = "Sort attributes"
|
|
272
|
-
default = true
|
|
273
|
-
}
|
|
274
|
-
["attributeSortOrder"] = new JsonSchema {
|
|
275
|
-
type = "string"
|
|
276
|
-
enum = new Listing { "alphabetical"; "as-written" }
|
|
277
|
-
description = "Attribute ordering strategy"
|
|
278
|
-
default = "alphabetical"
|
|
279
|
-
}
|
|
280
|
-
["mergeBindAndNonBindAttrs"] = new JsonSchema {
|
|
281
|
-
type = "boolean"
|
|
282
|
-
description = "Merge bind and non-bind attrs for sorting"
|
|
283
|
-
default = false
|
|
284
|
-
}
|
|
285
|
-
["maxAttributesPerLine"] = new JsonSchema {
|
|
286
|
-
type = "integer"
|
|
287
|
-
description = "Maximum attributes per line before wrapping"
|
|
288
|
-
}
|
|
289
|
-
["attributeGroups"] = new JsonSchema {
|
|
290
|
-
type = "array"
|
|
291
|
-
description = "Custom attribute groups"
|
|
292
|
-
items = new JsonSchema {
|
|
293
|
-
type = "array"
|
|
294
|
-
items = new JsonSchema { type = "string" }
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
["normalizeDirectiveShorthands"] = new JsonSchema {
|
|
298
|
-
type = "boolean"
|
|
299
|
-
description = "Normalize directive shorthands"
|
|
300
|
-
default = true
|
|
301
|
-
}
|
|
302
|
-
["sortBlocks"] = new JsonSchema {
|
|
303
|
-
type = "boolean"
|
|
304
|
-
description = "Sort SFC blocks in canonical order"
|
|
305
|
-
default = true
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
additionalProperties = false
|
|
309
|
-
}
|
|
310
|
-
|
|
311
143
|
local languageServerConfigDef: JsonSchema = new JsonSchema {
|
|
312
144
|
type = "object"
|
|
313
145
|
description = "Language server options"
|
|
@@ -548,7 +380,9 @@ output {
|
|
|
548
380
|
["CompilerCompatibilityConfig"] = ConfigArtifactDefinitions.compilerCompatibilityConfigDef
|
|
549
381
|
["CompilerConfig"] = ConfigArtifactDefinitions.compilerConfigDef
|
|
550
382
|
["VitePluginConfig"] = vitePluginConfigDef
|
|
551
|
-
["LinterConfig"] = linterConfigDef
|
|
383
|
+
["LinterConfig"] = LinterSchemaDefinitions.linterConfigDef
|
|
384
|
+
["SortImportsConfig"] = ImportSortSchemaDefinitions.sortImportsConfigDef
|
|
385
|
+
["ImportSortCustomGroup"] = ImportSortSchemaDefinitions.customGroupDef
|
|
552
386
|
["RestrictedGlobal"] = ConfigArtifactDefinitions.restrictedGlobalDef
|
|
553
387
|
["RestrictedMember"] = ConfigArtifactDefinitions.restrictedMemberDef
|
|
554
388
|
["NoRestrictedGlobalsOptions"] = ConfigArtifactDefinitions.noRestrictedGlobalsOptionsDef
|
|
@@ -557,7 +391,7 @@ output {
|
|
|
557
391
|
["MuseaPreferDesignTokensOptions"] = ConfigArtifactDefinitions.museaPreferDesignTokensOptionsDef
|
|
558
392
|
["LintRuleOptions"] = ConfigArtifactDefinitions.lintRuleOptionsDef
|
|
559
393
|
["TypeCheckerConfig"] = typeCheckerConfigDef
|
|
560
|
-
["FormatterConfig"] = formatterConfigDef
|
|
394
|
+
["FormatterConfig"] = FormatterSchemaDefinitions.formatterConfigDef
|
|
561
395
|
["LanguageServerConfig"] = languageServerConfigDef
|
|
562
396
|
["MuseaViewport"] = MuseaSchemaDefinitions.viewportDef
|
|
563
397
|
["MuseaVrtConfig"] = MuseaSchemaDefinitions.museaVrtConfigDef
|
package/pkl/vize.pkl
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
/// sourceMap = true
|
|
8
8
|
/// }
|
|
9
9
|
module vize.Config
|
|
10
|
+
import "SortImportsConfig.pkl"
|
|
10
11
|
|
|
11
12
|
typealias CompilerMode = "module" | "function"
|
|
12
13
|
typealias TemplateSyntax = "standard" | "strict" | "quirks"
|
|
@@ -135,7 +136,19 @@ class MuseaPreferDesignTokensOptions {
|
|
|
135
136
|
tokens: Listing<MuseaDesignToken>? = null
|
|
136
137
|
}
|
|
137
138
|
|
|
139
|
+
class StrictBooleanExpressionsOptions {
|
|
140
|
+
allowString: Boolean = true
|
|
141
|
+
allowNumber: Boolean = true
|
|
142
|
+
allowNullableObject: Boolean = true
|
|
143
|
+
allowNullableBoolean: Boolean = false
|
|
144
|
+
allowNullableString: Boolean = false
|
|
145
|
+
allowNullableNumber: Boolean = false
|
|
146
|
+
allowNullableEnum: Boolean = false
|
|
147
|
+
allowAny: Boolean = false
|
|
148
|
+
}
|
|
149
|
+
|
|
138
150
|
class LintRuleOptions {
|
|
151
|
+
`type/strict-boolean-expressions`: StrictBooleanExpressionsOptions? = null
|
|
139
152
|
`script/no-restricted-globals`: NoRestrictedGlobalsOptions? = null
|
|
140
153
|
`script/no-restricted-members`: NoRestrictedMembersOptions? = null
|
|
141
154
|
`vue/component-name-in-template-casing`: ComponentNameInTemplateCasingOptions? = null
|
|
@@ -152,6 +165,21 @@ class LinterConfig {
|
|
|
152
165
|
enabled: Boolean? = null
|
|
153
166
|
preset: LintPreset? = null
|
|
154
167
|
typeAware: Boolean? = null
|
|
168
|
+
/// Analyze relationships between input components.
|
|
169
|
+
crossFile: Boolean? = null
|
|
170
|
+
|
|
171
|
+
/// Display the provide/inject tree; enables cross-file analysis.
|
|
172
|
+
crossFileTree: Boolean? = null
|
|
173
|
+
|
|
174
|
+
/// Display cross-file complexity; enables cross-file analysis.
|
|
175
|
+
crossFileComplexity: Boolean? = null
|
|
176
|
+
|
|
177
|
+
/// Enable the native reactivity-loss rule unless rules explicitly disable it.
|
|
178
|
+
strictReactivity: Boolean? = null
|
|
179
|
+
|
|
180
|
+
/// Fail when warnings exceed this non-negative limit; absent means unlimited.
|
|
181
|
+
maxWarnings: Int(isBetween(0, 9007199254740991))? = null
|
|
182
|
+
|
|
155
183
|
rules: Mapping<String, RuleSeverity>? = null
|
|
156
184
|
ruleOptions: LintRuleOptions? = null
|
|
157
185
|
categories: Mapping<String, RuleSeverity>? = null
|
|
@@ -175,15 +203,34 @@ class TypeCheckerConfig {
|
|
|
175
203
|
tsgoPath: String? = null
|
|
176
204
|
globalsFile: String? = null
|
|
177
205
|
servers: Int? = null
|
|
206
|
+
lspRequestTimeoutMs: Int? = null
|
|
178
207
|
}
|
|
179
208
|
|
|
180
209
|
class FormatterConfig {
|
|
210
|
+
/// Oxfmt-compatible import sorting; false disables it.
|
|
211
|
+
sortImports: Boolean(this == false) | SortImportsConfig.SortImportsConfig? = null
|
|
212
|
+
|
|
181
213
|
printWidth: Int? = null
|
|
182
214
|
tabWidth: Int? = null
|
|
183
215
|
useTabs: Boolean? = null
|
|
184
216
|
semi: Boolean? = null
|
|
185
217
|
singleQuote: Boolean? = null
|
|
186
218
|
trailingComma: TrailingComma? = null
|
|
219
|
+
jsxSingleQuote: Boolean? = null
|
|
220
|
+
bracketSpacing: Boolean? = null
|
|
221
|
+
bracketSameLine: Boolean? = null
|
|
222
|
+
arrowParens: ("always"|"avoid")? = null
|
|
223
|
+
endOfLine: ("lf"|"crlf"|"cr"|"auto")? = null
|
|
224
|
+
quoteProps: ("as-needed"|"consistent"|"preserve")? = null
|
|
225
|
+
singleAttributePerLine: Boolean? = null
|
|
226
|
+
vueIndentScriptAndStyle: Boolean? = null
|
|
227
|
+
sortAttributes: Boolean? = null
|
|
228
|
+
attributeSortOrder: ("alphabetical"|"as-written")? = null
|
|
229
|
+
mergeBindAndNonBindAttrs: Boolean? = null
|
|
230
|
+
maxAttributesPerLine: Int? = null
|
|
231
|
+
attributeGroups: Listing<Listing<String>>? = null
|
|
232
|
+
normalizeDirectiveShorthands: Boolean? = null
|
|
233
|
+
sortBlocks: Boolean? = null
|
|
187
234
|
}
|
|
188
235
|
|
|
189
236
|
class LspConfig {
|
|
@@ -209,6 +209,27 @@
|
|
|
209
209
|
"description": "Enable native type-aware lint rules from the active lint configuration",
|
|
210
210
|
"type": "boolean"
|
|
211
211
|
},
|
|
212
|
+
"crossFile": {
|
|
213
|
+
"description": "Analyze relationships between input components",
|
|
214
|
+
"type": "boolean"
|
|
215
|
+
},
|
|
216
|
+
"crossFileTree": {
|
|
217
|
+
"description": "Display the provide/inject tree; enables cross-file analysis",
|
|
218
|
+
"type": "boolean"
|
|
219
|
+
},
|
|
220
|
+
"crossFileComplexity": {
|
|
221
|
+
"description": "Display cross-file complexity; enables cross-file analysis",
|
|
222
|
+
"type": "boolean"
|
|
223
|
+
},
|
|
224
|
+
"strictReactivity": {
|
|
225
|
+
"description": "Enable the native reactivity-loss rule unless rules explicitly disable it",
|
|
226
|
+
"type": "boolean"
|
|
227
|
+
},
|
|
228
|
+
"maxWarnings": {
|
|
229
|
+
"description": "Fail when warnings exceed this limit; absent means unlimited",
|
|
230
|
+
"type": "integer",
|
|
231
|
+
"minimum": 0
|
|
232
|
+
},
|
|
212
233
|
"rules": {
|
|
213
234
|
"description": "Rules to enable/disable",
|
|
214
235
|
"type": "object",
|
|
@@ -254,6 +275,94 @@
|
|
|
254
275
|
},
|
|
255
276
|
"additionalProperties": false
|
|
256
277
|
},
|
|
278
|
+
"SortImportsConfig": {
|
|
279
|
+
"type": "object",
|
|
280
|
+
"properties": {
|
|
281
|
+
"partitionByNewline": {
|
|
282
|
+
"type": "boolean"
|
|
283
|
+
},
|
|
284
|
+
"partitionByComment": {
|
|
285
|
+
"type": "boolean"
|
|
286
|
+
},
|
|
287
|
+
"sortSideEffects": {
|
|
288
|
+
"type": "boolean"
|
|
289
|
+
},
|
|
290
|
+
"order": {
|
|
291
|
+
"type": "string",
|
|
292
|
+
"enum": ["asc", "desc"]
|
|
293
|
+
},
|
|
294
|
+
"ignoreCase": {
|
|
295
|
+
"type": "boolean"
|
|
296
|
+
},
|
|
297
|
+
"newlinesBetween": {
|
|
298
|
+
"type": "boolean"
|
|
299
|
+
},
|
|
300
|
+
"internalPattern": {
|
|
301
|
+
"type": "array",
|
|
302
|
+
"items": {
|
|
303
|
+
"type": "string"
|
|
304
|
+
}
|
|
305
|
+
},
|
|
306
|
+
"groups": {
|
|
307
|
+
"type": "array",
|
|
308
|
+
"items": {
|
|
309
|
+
"oneOf": [
|
|
310
|
+
{
|
|
311
|
+
"type": "string"
|
|
312
|
+
},
|
|
313
|
+
{
|
|
314
|
+
"type": "array",
|
|
315
|
+
"items": {
|
|
316
|
+
"type": "string"
|
|
317
|
+
}
|
|
318
|
+
},
|
|
319
|
+
{
|
|
320
|
+
"type": "object",
|
|
321
|
+
"properties": {
|
|
322
|
+
"newlinesBetween": {
|
|
323
|
+
"type": "boolean"
|
|
324
|
+
}
|
|
325
|
+
},
|
|
326
|
+
"additionalProperties": false,
|
|
327
|
+
"required": ["newlinesBetween"]
|
|
328
|
+
}
|
|
329
|
+
]
|
|
330
|
+
}
|
|
331
|
+
},
|
|
332
|
+
"customGroups": {
|
|
333
|
+
"type": "array",
|
|
334
|
+
"items": {
|
|
335
|
+
"$ref": "#/definitions/ImportSortCustomGroup"
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
},
|
|
339
|
+
"additionalProperties": false
|
|
340
|
+
},
|
|
341
|
+
"ImportSortCustomGroup": {
|
|
342
|
+
"type": "object",
|
|
343
|
+
"properties": {
|
|
344
|
+
"groupName": {
|
|
345
|
+
"type": "string"
|
|
346
|
+
},
|
|
347
|
+
"elementNamePattern": {
|
|
348
|
+
"type": "array",
|
|
349
|
+
"items": {
|
|
350
|
+
"type": "string"
|
|
351
|
+
}
|
|
352
|
+
},
|
|
353
|
+
"selector": {
|
|
354
|
+
"type": "string"
|
|
355
|
+
},
|
|
356
|
+
"modifiers": {
|
|
357
|
+
"type": "array",
|
|
358
|
+
"items": {
|
|
359
|
+
"type": "string"
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
},
|
|
363
|
+
"additionalProperties": false,
|
|
364
|
+
"required": ["groupName"]
|
|
365
|
+
},
|
|
257
366
|
"RestrictedGlobal": {
|
|
258
367
|
"type": "object",
|
|
259
368
|
"properties": {
|
|
@@ -342,6 +451,44 @@
|
|
|
342
451
|
"LintRuleOptions": {
|
|
343
452
|
"type": "object",
|
|
344
453
|
"properties": {
|
|
454
|
+
"type/strict-boolean-expressions": {
|
|
455
|
+
"type": "object",
|
|
456
|
+
"properties": {
|
|
457
|
+
"allowString": {
|
|
458
|
+
"default": true,
|
|
459
|
+
"type": "boolean"
|
|
460
|
+
},
|
|
461
|
+
"allowNumber": {
|
|
462
|
+
"default": true,
|
|
463
|
+
"type": "boolean"
|
|
464
|
+
},
|
|
465
|
+
"allowNullableObject": {
|
|
466
|
+
"default": true,
|
|
467
|
+
"type": "boolean"
|
|
468
|
+
},
|
|
469
|
+
"allowNullableBoolean": {
|
|
470
|
+
"default": false,
|
|
471
|
+
"type": "boolean"
|
|
472
|
+
},
|
|
473
|
+
"allowNullableString": {
|
|
474
|
+
"default": false,
|
|
475
|
+
"type": "boolean"
|
|
476
|
+
},
|
|
477
|
+
"allowNullableNumber": {
|
|
478
|
+
"default": false,
|
|
479
|
+
"type": "boolean"
|
|
480
|
+
},
|
|
481
|
+
"allowNullableEnum": {
|
|
482
|
+
"default": false,
|
|
483
|
+
"type": "boolean"
|
|
484
|
+
},
|
|
485
|
+
"allowAny": {
|
|
486
|
+
"default": false,
|
|
487
|
+
"type": "boolean"
|
|
488
|
+
}
|
|
489
|
+
},
|
|
490
|
+
"additionalProperties": false
|
|
491
|
+
},
|
|
345
492
|
"script/no-restricted-globals": {
|
|
346
493
|
"$ref": "#/definitions/NoRestrictedGlobalsOptions"
|
|
347
494
|
},
|
|
@@ -535,6 +682,11 @@
|
|
|
535
682
|
"servers": {
|
|
536
683
|
"description": "Reserved Corsa server count. The direct project-session runner currently supports only 1.",
|
|
537
684
|
"type": "integer"
|
|
685
|
+
},
|
|
686
|
+
"lspRequestTimeoutMs": {
|
|
687
|
+
"description": "Hard bound in milliseconds for each editor Corsa request. Defaults to 60000; use a larger value for large cold projects.",
|
|
688
|
+
"type": "integer",
|
|
689
|
+
"minimum": 1
|
|
538
690
|
}
|
|
539
691
|
},
|
|
540
692
|
"additionalProperties": false
|
|
@@ -543,6 +695,18 @@
|
|
|
543
695
|
"description": "Formatter options",
|
|
544
696
|
"type": "object",
|
|
545
697
|
"properties": {
|
|
698
|
+
"sortImports": {
|
|
699
|
+
"description": "Oxfmt-compatible import sorting; false disables it",
|
|
700
|
+
"oneOf": [
|
|
701
|
+
{
|
|
702
|
+
"type": "boolean",
|
|
703
|
+
"enum": [false]
|
|
704
|
+
},
|
|
705
|
+
{
|
|
706
|
+
"$ref": "#/definitions/SortImportsConfig"
|
|
707
|
+
}
|
|
708
|
+
]
|
|
709
|
+
},
|
|
546
710
|
"printWidth": {
|
|
547
711
|
"description": "Max line width",
|
|
548
712
|
"default": 100,
|
package/src/init/detect.ts
CHANGED
|
@@ -38,6 +38,7 @@ export interface ProjectDetection {
|
|
|
38
38
|
readonly packageManager: PackageManager | null;
|
|
39
39
|
readonly framework: Framework;
|
|
40
40
|
readonly nuxtConfig: string | null;
|
|
41
|
+
readonly nuxtMajor: number | null;
|
|
41
42
|
readonly viteConfigs: readonly string[];
|
|
42
43
|
readonly usesVitePlus: boolean;
|
|
43
44
|
readonly typescript: boolean;
|
|
@@ -138,6 +139,7 @@ export function detectProject(root: string): ProjectDetection {
|
|
|
138
139
|
packageManager: detectPackageManager(root),
|
|
139
140
|
framework: detectFramework(nuxtConfig, viteConfigs, dependencies),
|
|
140
141
|
nuxtConfig,
|
|
142
|
+
nuxtMajor: declaredNuxtMajor(packageJson),
|
|
141
143
|
viteConfigs,
|
|
142
144
|
usesVitePlus: detectVitePlus(dependencies, viteSource, scripts),
|
|
143
145
|
typescript: dependencies.has("typescript") || fs.existsSync(path.join(root, "tsconfig.json")),
|
|
@@ -153,6 +155,21 @@ export function detectProject(root: string): ProjectDetection {
|
|
|
153
155
|
};
|
|
154
156
|
}
|
|
155
157
|
|
|
158
|
+
function declaredNuxtMajor(packageJson: Record<string, unknown>): number | null {
|
|
159
|
+
for (const field of ["dependencies", "devDependencies", "optionalDependencies"]) {
|
|
160
|
+
const group = packageJson[field];
|
|
161
|
+
if (group === null || typeof group !== "object" || Array.isArray(group)) {
|
|
162
|
+
continue;
|
|
163
|
+
}
|
|
164
|
+
const version = (group as Record<string, unknown>).nuxt;
|
|
165
|
+
const major = typeof version === "string" ? /^[~^<>=\s]*(\d+)(?:\.|$)/u.exec(version) : null;
|
|
166
|
+
if (major) {
|
|
167
|
+
return Number(major[1]);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
return null;
|
|
171
|
+
}
|
|
172
|
+
|
|
156
173
|
function detectFramework(
|
|
157
174
|
nuxtConfig: string | null,
|
|
158
175
|
viteConfigs: readonly string[],
|
package/src/init/plan-project.ts
CHANGED
|
@@ -32,7 +32,10 @@ export function planVizeConfig(
|
|
|
32
32
|
if (selection.typecheck && detection.tsconfig === null) {
|
|
33
33
|
draft.files.push({
|
|
34
34
|
filename: path.join(detection.root, "tsconfig.json"),
|
|
35
|
-
source: renderTypecheckTsconfig(
|
|
35
|
+
source: renderTypecheckTsconfig(
|
|
36
|
+
detection.typescript,
|
|
37
|
+
detection.framework === "nuxt" ? detection.nuxtMajor : undefined,
|
|
38
|
+
),
|
|
36
39
|
});
|
|
37
40
|
draft.createdFiles.push("tsconfig.json");
|
|
38
41
|
}
|
|
@@ -101,7 +104,10 @@ export function planScripts(
|
|
|
101
104
|
const packageJson = parsePackageJson(packagePath, source);
|
|
102
105
|
const scripts = { ...detection.scripts } as Record<string, string>;
|
|
103
106
|
for (const name of missing) {
|
|
104
|
-
scripts[name] =
|
|
107
|
+
scripts[name] =
|
|
108
|
+
name === "vize:check" && detection.framework === "nuxt"
|
|
109
|
+
? "nuxt prepare && vize check"
|
|
110
|
+
: DEFAULT_SCRIPTS[name as keyof typeof DEFAULT_SCRIPTS];
|
|
105
111
|
}
|
|
106
112
|
packageJson.scripts = scripts;
|
|
107
113
|
draft.files.push({
|
package/src/init/templates.ts
CHANGED
|
@@ -67,7 +67,19 @@ ${blocks.join("\n")}
|
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
/** Minimum project config written only when typechecking is selected and no config exists. */
|
|
70
|
-
export function renderTypecheckTsconfig(typescript: boolean): string {
|
|
70
|
+
export function renderTypecheckTsconfig(typescript: boolean, nuxtMajor?: number | null): string {
|
|
71
|
+
if (nuxtMajor !== undefined) {
|
|
72
|
+
const config =
|
|
73
|
+
nuxtMajor !== null && nuxtMajor >= 4
|
|
74
|
+
? {
|
|
75
|
+
files: [],
|
|
76
|
+
references: ["app", "server", "shared", "node"].map((part) => ({
|
|
77
|
+
path: `./.nuxt/tsconfig.${part}.json`,
|
|
78
|
+
})),
|
|
79
|
+
}
|
|
80
|
+
: { extends: "./.nuxt/tsconfig.json" };
|
|
81
|
+
return `${JSON.stringify(config, null, 2)}\n`;
|
|
82
|
+
}
|
|
71
83
|
const compilerOptions: Record<string, boolean | string> = {
|
|
72
84
|
strict: true,
|
|
73
85
|
target: "ES2022",
|
package/src/types/generated.ts
CHANGED
|
@@ -207,6 +207,26 @@ export interface LinterConfig {
|
|
|
207
207
|
* Enable native type-aware lint rules from the active lint configuration
|
|
208
208
|
*/
|
|
209
209
|
typeAware?: boolean;
|
|
210
|
+
/**
|
|
211
|
+
* Analyze relationships between input components
|
|
212
|
+
*/
|
|
213
|
+
crossFile?: boolean;
|
|
214
|
+
/**
|
|
215
|
+
* Display the provide/inject tree; enables cross-file analysis
|
|
216
|
+
*/
|
|
217
|
+
crossFileTree?: boolean;
|
|
218
|
+
/**
|
|
219
|
+
* Display cross-file complexity; enables cross-file analysis
|
|
220
|
+
*/
|
|
221
|
+
crossFileComplexity?: boolean;
|
|
222
|
+
/**
|
|
223
|
+
* Enable the native reactivity-loss rule unless rules explicitly disable it
|
|
224
|
+
*/
|
|
225
|
+
strictReactivity?: boolean;
|
|
226
|
+
/**
|
|
227
|
+
* Fail when warnings exceed this limit; absent means unlimited
|
|
228
|
+
*/
|
|
229
|
+
maxWarnings?: number;
|
|
210
230
|
/**
|
|
211
231
|
* Rules to enable/disable
|
|
212
232
|
*/
|
|
@@ -227,6 +247,16 @@ export interface LinterConfig {
|
|
|
227
247
|
};
|
|
228
248
|
}
|
|
229
249
|
export interface LintRuleOptions {
|
|
250
|
+
"type/strict-boolean-expressions"?: {
|
|
251
|
+
allowString?: boolean;
|
|
252
|
+
allowNumber?: boolean;
|
|
253
|
+
allowNullableObject?: boolean;
|
|
254
|
+
allowNullableBoolean?: boolean;
|
|
255
|
+
allowNullableString?: boolean;
|
|
256
|
+
allowNullableNumber?: boolean;
|
|
257
|
+
allowNullableEnum?: boolean;
|
|
258
|
+
allowAny?: boolean;
|
|
259
|
+
};
|
|
230
260
|
"script/no-restricted-globals"?: NoRestrictedGlobalsOptions;
|
|
231
261
|
"script/no-restricted-members"?: NoRestrictedMembersOptions;
|
|
232
262
|
"vue/component-name-in-template-casing"?: {
|
|
@@ -355,11 +385,19 @@ export interface TypeCheckerConfig {
|
|
|
355
385
|
* Reserved Corsa server count. The direct project-session runner currently supports only 1.
|
|
356
386
|
*/
|
|
357
387
|
servers?: number;
|
|
388
|
+
/**
|
|
389
|
+
* Hard bound in milliseconds for each editor Corsa request. Defaults to 60000; use a larger value for large cold projects.
|
|
390
|
+
*/
|
|
391
|
+
lspRequestTimeoutMs?: number;
|
|
358
392
|
}
|
|
359
393
|
/**
|
|
360
394
|
* Formatter options
|
|
361
395
|
*/
|
|
362
396
|
export interface FormatterConfig {
|
|
397
|
+
/**
|
|
398
|
+
* Oxfmt-compatible import sorting; false disables it
|
|
399
|
+
*/
|
|
400
|
+
sortImports?: false | SortImportsConfig;
|
|
363
401
|
/**
|
|
364
402
|
* Max line width
|
|
365
403
|
*/
|
|
@@ -445,6 +483,29 @@ export interface FormatterConfig {
|
|
|
445
483
|
*/
|
|
446
484
|
sortBlocks?: boolean;
|
|
447
485
|
}
|
|
486
|
+
export interface SortImportsConfig {
|
|
487
|
+
partitionByNewline?: boolean;
|
|
488
|
+
partitionByComment?: boolean;
|
|
489
|
+
sortSideEffects?: boolean;
|
|
490
|
+
order?: "asc" | "desc";
|
|
491
|
+
ignoreCase?: boolean;
|
|
492
|
+
newlinesBetween?: boolean;
|
|
493
|
+
internalPattern?: string[];
|
|
494
|
+
groups?: (
|
|
495
|
+
| string
|
|
496
|
+
| string[]
|
|
497
|
+
| {
|
|
498
|
+
newlinesBetween: boolean;
|
|
499
|
+
}
|
|
500
|
+
)[];
|
|
501
|
+
customGroups?: ImportSortCustomGroup[];
|
|
502
|
+
}
|
|
503
|
+
export interface ImportSortCustomGroup {
|
|
504
|
+
groupName: string;
|
|
505
|
+
elementNamePattern?: string[];
|
|
506
|
+
selector?: string;
|
|
507
|
+
modifiers?: string[];
|
|
508
|
+
}
|
|
448
509
|
/**
|
|
449
510
|
* Language server options
|
|
450
511
|
*/
|