oxlint-plugin-vize 0.270.0 → 0.272.0
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 +9 -4
- package/dist/index.mjs +68 -14
- package/package.json +10 -10
package/README.md
CHANGED
|
@@ -75,13 +75,14 @@ export default {
|
|
|
75
75
|
vize: {
|
|
76
76
|
helpLevel: "short",
|
|
77
77
|
preset: "opinionated",
|
|
78
|
+
typeAware: true,
|
|
78
79
|
},
|
|
79
80
|
},
|
|
80
|
-
rules: configs.
|
|
81
|
+
rules: configs.opinionatedWithTypeAware,
|
|
81
82
|
};
|
|
82
83
|
```
|
|
83
84
|
|
|
84
|
-
`configs.recommended`, `configs.essential`, `configs.ecosystem`, `configs.opinionated`, `configs.nuxt`, and `configs.all` intentionally skip Vize's unstable type-aware rules for now. If you explicitly want those experimental rules too, use `configs.recommendedWithTypeAware`, `configs.ecosystemWithTypeAware`, `configs.opinionatedWithTypeAware`, or `createVizeRuleConfig({ includeTypeAware: true, preset: ... })`.
|
|
85
|
+
`configs.recommended`, `configs.essential`, `configs.ecosystem`, `configs.opinionated`, `configs.nuxt`, and `configs.all` intentionally skip Vize's unstable type-aware rules for now. If you explicitly want those experimental rules too, use `configs.recommendedWithTypeAware`, `configs.ecosystemWithTypeAware`, `configs.opinionatedWithTypeAware`, or `createVizeRuleConfig({ includeTypeAware: true, preset: ... })`. Set `settings.vize.typeAware: true` to run the shared full-file Patina pass with Corsa enabled; explicitly configured `vize/type/*` rules also opt in when they are queried one by one.
|
|
85
86
|
|
|
86
87
|
You can pass Patina settings through `settings.vize`:
|
|
87
88
|
|
|
@@ -91,7 +92,9 @@ You can pass Patina settings through `settings.vize`:
|
|
|
91
92
|
"vize": {
|
|
92
93
|
"locale": "ja",
|
|
93
94
|
"preset": "essential",
|
|
94
|
-
"helpLevel": "short"
|
|
95
|
+
"helpLevel": "short",
|
|
96
|
+
"typeAware": true,
|
|
97
|
+
"corsaPath": "./node_modules/.bin/tsgo"
|
|
95
98
|
}
|
|
96
99
|
}
|
|
97
100
|
}
|
|
@@ -106,6 +109,8 @@ You can pass Patina settings through `settings.vize`:
|
|
|
106
109
|
- Legacy aliases such as `"GeneralRecommended"`, `"Essential"`, `"Ecosystem"`, `"Incremental"`, `"Opinionated"`, `"Nuxt"`, and `"happy-path"` are still accepted for compatibility.
|
|
107
110
|
- `helpLevel` accepts `"full"`, `"short"`, or `"none"`.
|
|
108
111
|
- `helpLevel: "full"` only expands the Patina remediation text. It does not restore original-SFC formatter anchors or machine-readable range fidelity.
|
|
112
|
+
- `typeAware: true` enables Corsa-backed `vize/type/*` rules during shared Patina passes.
|
|
113
|
+
- `corsaPath` selects the Corsa or `tsgo` executable for type-aware linting. Omit it to use Vize's normal resolver.
|
|
109
114
|
- `showHelp` is still accepted for backward compatibility, but `helpLevel` is the preferred setting.
|
|
110
115
|
|
|
111
116
|
For example, this keeps Oxlint focused on correctness-only Vize diagnostics while still allowing your existing Oxlint rules to run unchanged:
|
|
@@ -145,7 +150,7 @@ vp exec oxlint-vize -c .oxlintrc.json -f stylish src
|
|
|
145
150
|
- Formatter parity is not there yet. `stylish` is recommended for human-readable terminal output, while `json` and other machine-readable outputs are best treated as debugging aids for original template/style positions.
|
|
146
151
|
- Oxlint core rules that need JavaScript bindings extracted from Vue templates, such as template-aware unused-variable checks, still depend on upstream work in [Oxc's Better Vue Support](https://github.com/oxc-project/oxc/issues/15761).
|
|
147
152
|
- Vize's own SFC diagnostics can run through the plugin, but precise original-SFC ranges across all Oxlint formatters depend on the JS plugin reporting work tracked in [oxc-project/oxc#20465](https://github.com/oxc-project/oxc/issues/20465).
|
|
148
|
-
- Type-aware Vize rules are experimental and excluded from the default exported configs. Opt into them explicitly with `configs.recommendedWithTypeAware`, `configs.opinionatedWithTypeAware`, or `createVizeRuleConfig({ includeTypeAware: true, preset: ... })
|
|
153
|
+
- Type-aware Vize rules are experimental and excluded from the default exported configs. Opt into them explicitly with `configs.recommendedWithTypeAware`, `configs.opinionatedWithTypeAware`, or `createVizeRuleConfig({ includeTypeAware: true, preset: ... })`, and use `settings.vize.typeAware: true` when you want the shared full-file pass to run them eagerly.
|
|
149
154
|
|
|
150
155
|
## Current expectations
|
|
151
156
|
|
package/dist/index.mjs
CHANGED
|
@@ -101,7 +101,9 @@ function lintPatina(source, filename, settings, enabledRules) {
|
|
|
101
101
|
locale: settings.locale,
|
|
102
102
|
helpLevel: settings.helpLevel,
|
|
103
103
|
preset: settings.preset,
|
|
104
|
-
enabledRules: enabledRules ? [...enabledRules] : void 0
|
|
104
|
+
enabledRules: enabledRules ? [...enabledRules] : void 0,
|
|
105
|
+
typeAware: settings.typeAware,
|
|
106
|
+
corsaPath: settings.corsaPath
|
|
105
107
|
});
|
|
106
108
|
}
|
|
107
109
|
function getPatinaRules() {
|
|
@@ -142,6 +144,7 @@ const HELP_LEVELS = new Set([
|
|
|
142
144
|
"short",
|
|
143
145
|
"full"
|
|
144
146
|
]);
|
|
147
|
+
const TYPE_AWARE_RULE_PREFIX$1 = "type/";
|
|
145
148
|
const PRESET_ALIASES = new Map([
|
|
146
149
|
["generalrecommended", "general-recommended"],
|
|
147
150
|
["happypath", "general-recommended"],
|
|
@@ -172,12 +175,16 @@ function parseVizeSettings(vize) {
|
|
|
172
175
|
const helpLevel = vizeRecord.helpLevel;
|
|
173
176
|
const preset = vizeRecord.preset;
|
|
174
177
|
const showHelp = vizeRecord.showHelp;
|
|
178
|
+
const typeAware = vizeRecord.typeAware;
|
|
179
|
+
const corsaPath = vizeRecord.corsaPath;
|
|
175
180
|
const resolved = {};
|
|
176
181
|
if (typeof locale === "string") resolved.locale = locale;
|
|
177
182
|
if (typeof preset === "string") {
|
|
178
183
|
const normalizedPreset = normalizePreset(preset);
|
|
179
184
|
if (normalizedPreset) resolved.preset = normalizedPreset;
|
|
180
185
|
}
|
|
186
|
+
if (typeof typeAware === "boolean") resolved.typeAware = typeAware;
|
|
187
|
+
if (typeof corsaPath === "string") resolved.corsaPath = corsaPath;
|
|
181
188
|
if (typeof helpLevel === "string" && HELP_LEVELS.has(helpLevel)) {
|
|
182
189
|
resolved.helpLevel = helpLevel;
|
|
183
190
|
return resolved;
|
|
@@ -192,7 +199,17 @@ function isIncrementalPreset(settings) {
|
|
|
192
199
|
return getActivePreset(settings) === "incremental";
|
|
193
200
|
}
|
|
194
201
|
function getCacheKey(filename, settings) {
|
|
195
|
-
return
|
|
202
|
+
return [
|
|
203
|
+
filename,
|
|
204
|
+
settings.locale ?? "",
|
|
205
|
+
settings.helpLevel ?? "",
|
|
206
|
+
getActivePreset(settings),
|
|
207
|
+
settings.typeAware ? "type-aware" : "",
|
|
208
|
+
settings.corsaPath ?? ""
|
|
209
|
+
].join("::");
|
|
210
|
+
}
|
|
211
|
+
function isTypeAwareRuleName(ruleName) {
|
|
212
|
+
return ruleName.startsWith(TYPE_AWARE_RULE_PREFIX$1);
|
|
196
213
|
}
|
|
197
214
|
function normalizePreset(value) {
|
|
198
215
|
return PRESET_ALIASES.get(value.replaceAll(/[-_\s]/gu, "").toLowerCase());
|
|
@@ -200,15 +217,19 @@ function normalizePreset(value) {
|
|
|
200
217
|
if (import.meta.vitest) {
|
|
201
218
|
const { describe, expect, it } = import.meta.vitest;
|
|
202
219
|
describe("parseVizeSettings", () => {
|
|
203
|
-
it("reads locale, help level, and
|
|
220
|
+
it("reads locale, help level, preset, and type-aware settings", () => {
|
|
204
221
|
expect(parseVizeSettings({
|
|
205
222
|
locale: "ja",
|
|
206
223
|
helpLevel: "short",
|
|
207
|
-
preset: "essential"
|
|
224
|
+
preset: "essential",
|
|
225
|
+
typeAware: true,
|
|
226
|
+
corsaPath: "./node_modules/.bin/tsgo"
|
|
208
227
|
})).toEqual({
|
|
209
228
|
locale: "ja",
|
|
210
229
|
helpLevel: "short",
|
|
211
|
-
preset: "essential"
|
|
230
|
+
preset: "essential",
|
|
231
|
+
typeAware: true,
|
|
232
|
+
corsaPath: "./node_modules/.bin/tsgo"
|
|
212
233
|
});
|
|
213
234
|
});
|
|
214
235
|
it("normalizes preset aliases", () => {
|
|
@@ -234,7 +255,9 @@ if (import.meta.vitest) {
|
|
|
234
255
|
locale: 1,
|
|
235
256
|
showHelp: "no",
|
|
236
257
|
helpLevel: "verbose",
|
|
237
|
-
preset: "wide"
|
|
258
|
+
preset: "wide",
|
|
259
|
+
typeAware: "yes",
|
|
260
|
+
corsaPath: false
|
|
238
261
|
})).toEqual({});
|
|
239
262
|
});
|
|
240
263
|
it("ignores non-object vize settings", () => {
|
|
@@ -247,6 +270,7 @@ if (import.meta.vitest) {
|
|
|
247
270
|
//#region src/file-state.ts
|
|
248
271
|
const fileStateCache = /* @__PURE__ */ new Map();
|
|
249
272
|
const EMPTY_DIAGNOSTICS = [];
|
|
273
|
+
const TYPE_AWARE_RUNTIME_RULE = "type/corsa-runtime";
|
|
250
274
|
function getFileState(context) {
|
|
251
275
|
const settings = getVizeSettings(context);
|
|
252
276
|
const resolvedSource = resolveWorkaroundSource(fs.readFileSync(context.physicalFilename, "utf8"), context.physicalFilename);
|
|
@@ -262,35 +286,56 @@ function getFileState(context) {
|
|
|
262
286
|
sfcBlocks: void 0,
|
|
263
287
|
scriptMap: void 0,
|
|
264
288
|
allDiagnosticsByRule: null,
|
|
289
|
+
allDiagnosticsIncludesTypeAware: false,
|
|
265
290
|
partialDiagnosticsByRule: /* @__PURE__ */ new Map(),
|
|
266
|
-
requestedRules: /* @__PURE__ */ new Set()
|
|
291
|
+
requestedRules: /* @__PURE__ */ new Set(),
|
|
292
|
+
reportedTypeAwareRuntimeDiagnostic: false
|
|
267
293
|
};
|
|
268
294
|
fileStateCache.set(cacheKey, state);
|
|
269
295
|
return state;
|
|
270
296
|
}
|
|
271
297
|
function getDiagnosticsForRule(context, state, ruleName) {
|
|
272
|
-
if (state.allDiagnosticsByRule)
|
|
298
|
+
if (state.allDiagnosticsByRule) {
|
|
299
|
+
if (isTypeAwareRuleName(ruleName) && !state.allDiagnosticsIncludesTypeAware) {
|
|
300
|
+
const settings = getVizeSettings(context);
|
|
301
|
+
state.allDiagnosticsByRule = indexDiagnosticsByRule(lintPatina(state.source, state.filename, {
|
|
302
|
+
...settings,
|
|
303
|
+
typeAware: true
|
|
304
|
+
}).diagnostics);
|
|
305
|
+
state.allDiagnosticsIncludesTypeAware = true;
|
|
306
|
+
}
|
|
307
|
+
return diagnosticsForRule(state, state.allDiagnosticsByRule, ruleName);
|
|
308
|
+
}
|
|
273
309
|
const cached = state.partialDiagnosticsByRule.get(ruleName);
|
|
274
310
|
if (cached) return cached;
|
|
275
311
|
const settings = getVizeSettings(context);
|
|
312
|
+
const ruleSettings = isTypeAwareRuleName(ruleName) ? {
|
|
313
|
+
...settings,
|
|
314
|
+
typeAware: true
|
|
315
|
+
} : settings;
|
|
276
316
|
if (isIncrementalPreset(settings)) {
|
|
277
|
-
const diagnostics = lintPatina(state.source, state.filename,
|
|
278
|
-
const ruleDiagnostics = indexDiagnosticsByRule(diagnostics)
|
|
317
|
+
const diagnostics = lintPatina(state.source, state.filename, ruleSettings, [ruleName]).diagnostics;
|
|
318
|
+
const ruleDiagnostics = diagnosticsForRule(state, indexDiagnosticsByRule(diagnostics), ruleName);
|
|
279
319
|
state.partialDiagnosticsByRule.set(ruleName, ruleDiagnostics);
|
|
280
320
|
return ruleDiagnostics;
|
|
281
321
|
}
|
|
282
322
|
if (state.requestedRules.size === 0) {
|
|
283
323
|
state.requestedRules.add(ruleName);
|
|
284
|
-
const diagnostics = lintPatina(state.source, state.filename,
|
|
285
|
-
const ruleDiagnostics = indexDiagnosticsByRule(diagnostics)
|
|
324
|
+
const diagnostics = lintPatina(state.source, state.filename, ruleSettings, [ruleName]).diagnostics;
|
|
325
|
+
const ruleDiagnostics = diagnosticsForRule(state, indexDiagnosticsByRule(diagnostics), ruleName);
|
|
286
326
|
state.partialDiagnosticsByRule.set(ruleName, ruleDiagnostics);
|
|
287
327
|
return ruleDiagnostics;
|
|
288
328
|
}
|
|
289
329
|
state.requestedRules.add(ruleName);
|
|
290
|
-
const
|
|
330
|
+
const fullPassTypeAware = settings.typeAware === true || Array.from(state.requestedRules).some(isTypeAwareRuleName);
|
|
331
|
+
const allDiagnostics = lintPatina(state.source, state.filename, {
|
|
332
|
+
...settings,
|
|
333
|
+
typeAware: fullPassTypeAware
|
|
334
|
+
}).diagnostics;
|
|
291
335
|
state.allDiagnosticsByRule = indexDiagnosticsByRule(allDiagnostics);
|
|
336
|
+
state.allDiagnosticsIncludesTypeAware = fullPassTypeAware;
|
|
292
337
|
state.partialDiagnosticsByRule.clear();
|
|
293
|
-
return state.allDiagnosticsByRule
|
|
338
|
+
return diagnosticsForRule(state, state.allDiagnosticsByRule, ruleName);
|
|
294
339
|
}
|
|
295
340
|
function getScriptMap(state) {
|
|
296
341
|
if (state.scriptMap !== void 0) return state.scriptMap;
|
|
@@ -319,6 +364,15 @@ function indexDiagnosticsByRule(diagnostics) {
|
|
|
319
364
|
}
|
|
320
365
|
return grouped;
|
|
321
366
|
}
|
|
367
|
+
function diagnosticsForRule(state, diagnosticsByRule, ruleName) {
|
|
368
|
+
const directDiagnostics = diagnosticsByRule.get(ruleName);
|
|
369
|
+
if (directDiagnostics && directDiagnostics.length > 0) return directDiagnostics;
|
|
370
|
+
if (!isTypeAwareRuleName(ruleName) || state.reportedTypeAwareRuntimeDiagnostic) return EMPTY_DIAGNOSTICS;
|
|
371
|
+
const runtimeDiagnostics = diagnosticsByRule.get(TYPE_AWARE_RUNTIME_RULE);
|
|
372
|
+
if (!runtimeDiagnostics || runtimeDiagnostics.length === 0) return EMPTY_DIAGNOSTICS;
|
|
373
|
+
state.reportedTypeAwareRuntimeDiagnostic = true;
|
|
374
|
+
return runtimeDiagnostics;
|
|
375
|
+
}
|
|
322
376
|
//#endregion
|
|
323
377
|
//#region src/format.ts
|
|
324
378
|
const helpTextCache = /* @__PURE__ */ new Map();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oxlint-plugin-vize",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.272.0",
|
|
4
4
|
"description": "Oxlint JS plugin bridge for Vize Patina",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"lint",
|
|
@@ -44,21 +44,21 @@
|
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@tsdown/css": "0.22.0",
|
|
46
46
|
"@types/node": "25.9.2",
|
|
47
|
-
"@vizejs/native": "0.
|
|
47
|
+
"@vizejs/native": "0.272.0",
|
|
48
48
|
"tsdown": "0.22.0",
|
|
49
49
|
"typescript": "6.0.3",
|
|
50
50
|
"vite": "npm:@voidzero-dev/vite-plus-core@0.1.21",
|
|
51
51
|
"vite-plus": "0.1.21"
|
|
52
52
|
},
|
|
53
53
|
"optionalDependencies": {
|
|
54
|
-
"@vizejs/native-darwin-arm64": "0.
|
|
55
|
-
"@vizejs/native-darwin-x64": "0.
|
|
56
|
-
"@vizejs/native-linux-arm64-gnu": "0.
|
|
57
|
-
"@vizejs/native-linux-arm64-musl": "0.
|
|
58
|
-
"@vizejs/native-linux-x64-gnu": "0.
|
|
59
|
-
"@vizejs/native-linux-x64-musl": "0.
|
|
60
|
-
"@vizejs/native-win32-arm64-msvc": "0.
|
|
61
|
-
"@vizejs/native-win32-x64-msvc": "0.
|
|
54
|
+
"@vizejs/native-darwin-arm64": "0.272.0",
|
|
55
|
+
"@vizejs/native-darwin-x64": "0.272.0",
|
|
56
|
+
"@vizejs/native-linux-arm64-gnu": "0.272.0",
|
|
57
|
+
"@vizejs/native-linux-arm64-musl": "0.272.0",
|
|
58
|
+
"@vizejs/native-linux-x64-gnu": "0.272.0",
|
|
59
|
+
"@vizejs/native-linux-x64-musl": "0.272.0",
|
|
60
|
+
"@vizejs/native-win32-arm64-msvc": "0.272.0",
|
|
61
|
+
"@vizejs/native-win32-x64-msvc": "0.272.0"
|
|
62
62
|
},
|
|
63
63
|
"engines": {
|
|
64
64
|
"node": "^22 || >= 24"
|