vize 0.390.0 → 0.404.8
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/dist/cli.mjs +15 -20
- package/dist/cli.mjs.map +1 -1
- package/dist/{config-BVly6DWf.d.mts → config-DyVRxv1Z.d.mts} +43 -2
- package/dist/config-DyVRxv1Z.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/LinterConfig.pkl +67 -1
- package/pkl/jsonschema/ConfigArtifactDefinitions.pkl +141 -5
- package/pkl/jsonschema/generate.pkl +3 -3
- package/pkl/vize.pkl +53 -0
- package/schemas/vize.config.schema.json +135 -1
- package/src/init/templates.ts +7 -7
- package/src/setup/config.ts +2 -2
- package/src/setup/vite.ts +6 -12
- package/src/types/generated.ts +41 -0
- package/src/types/rules.ts +3 -0
- package/dist/config-BVly6DWf.d.mts.map +0 -1
package/dist/cli.mjs
CHANGED
|
@@ -142,11 +142,11 @@ export default defineConfig({
|
|
|
142
142
|
jsPlugins: ["oxlint-plugin-vize"],
|
|
143
143
|
settings: {
|
|
144
144
|
vize: {
|
|
145
|
-
preset: "
|
|
145
|
+
preset: "happy-path",
|
|
146
146
|
helpLevel: "short",
|
|
147
147
|
},
|
|
148
148
|
},
|
|
149
|
-
rules: configs.
|
|
149
|
+
rules: configs.happyPath,
|
|
150
150
|
});
|
|
151
151
|
`;
|
|
152
152
|
function readRequiredFile(filename, message) {
|
|
@@ -240,8 +240,8 @@ function isNodeError(value) {
|
|
|
240
240
|
* `vp lint` block and the `oxlint` config can never describe different presets.
|
|
241
241
|
* See `lint-target.ts` for why writing the wrong one of the two is silent.
|
|
242
242
|
*/
|
|
243
|
-
/**
|
|
244
|
-
const INIT_LINT_PRESET = "
|
|
243
|
+
/** User-facing preset alias both Oxlint entry points run with. */
|
|
244
|
+
const INIT_LINT_PRESET = "happy-path";
|
|
245
245
|
/** `settings.vize.helpLevel` both Oxlint entry points run with. */
|
|
246
246
|
const INIT_LINT_HELP_LEVEL = "short";
|
|
247
247
|
/** VS Code extension id published from `editors/vscode`. */
|
|
@@ -302,7 +302,7 @@ function renderTypecheckTsconfig(typescript) {
|
|
|
302
302
|
/**
|
|
303
303
|
* Config for the `oxlint` binary.
|
|
304
304
|
*
|
|
305
|
-
* `.oxlintrc.json` cannot import `configs.
|
|
305
|
+
* `.oxlintrc.json` cannot import `configs.happyPath`, and the bridge only runs
|
|
306
306
|
* `vize/*` rules that appear in `rules`, so a JSON config would need every rule
|
|
307
307
|
* id inlined and would rot on the next rule addition. `oxlint.config.ts` is
|
|
308
308
|
* Oxlint's TypeScript config format and is auto-discovered (verified against
|
|
@@ -321,7 +321,7 @@ export default defineConfig({
|
|
|
321
321
|
helpLevel: "${INIT_LINT_HELP_LEVEL}",
|
|
322
322
|
},
|
|
323
323
|
},
|
|
324
|
-
rules: configs.
|
|
324
|
+
rules: configs.happyPath,
|
|
325
325
|
});
|
|
326
326
|
`;
|
|
327
327
|
/** Import line the Vite+ `lint` block needs. */
|
|
@@ -330,9 +330,9 @@ const VITE_LINT_IMPORT = "import { createVizeLintConfig } from \"oxlint-plugin-v
|
|
|
330
330
|
* The Vite+ `lint` block, the only Oxlint configuration `vp lint` and `vp check`
|
|
331
331
|
* read.
|
|
332
332
|
*
|
|
333
|
-
* `createVizeLintConfig()` returns
|
|
334
|
-
*
|
|
335
|
-
*
|
|
333
|
+
* `createVizeLintConfig()` returns a complete block, which is what makes the
|
|
334
|
+
* `jsPlugins` entry impossible to omit. Hand-assembling the block is how a config
|
|
335
|
+
* ends up looking wired while reporting nothing.
|
|
336
336
|
*/
|
|
337
337
|
const VITE_LINT_BLOCK = ` lint: createVizeLintConfig({
|
|
338
338
|
preset: "${INIT_LINT_PRESET}",
|
|
@@ -1833,18 +1833,13 @@ const VITE_CONFIG_FILES = [
|
|
|
1833
1833
|
"vite.config.js",
|
|
1834
1834
|
"vite.config.mjs"
|
|
1835
1835
|
];
|
|
1836
|
-
const VITE_PLUS_LINT_IMPORT = "import {
|
|
1837
|
-
const VITE_PLUS_LINT_BLOCK = ` lint: {
|
|
1838
|
-
|
|
1839
|
-
jsPlugins: ["oxlint-plugin-vize"],
|
|
1836
|
+
const VITE_PLUS_LINT_IMPORT = "import { createVizeLintConfig } from \"oxlint-plugin-vize\";\n";
|
|
1837
|
+
const VITE_PLUS_LINT_BLOCK = ` lint: createVizeLintConfig({
|
|
1838
|
+
preset: "happy-path",
|
|
1840
1839
|
settings: {
|
|
1841
|
-
|
|
1842
|
-
preset: "general-recommended",
|
|
1843
|
-
helpLevel: "short",
|
|
1844
|
-
},
|
|
1840
|
+
helpLevel: "short",
|
|
1845
1841
|
},
|
|
1846
|
-
|
|
1847
|
-
},
|
|
1842
|
+
}),
|
|
1848
1843
|
`;
|
|
1849
1844
|
function planViteMigration(root, mayConfigureVitePlusLint) {
|
|
1850
1845
|
const existing = VITE_CONFIG_FILES.filter((candidate) => fs.existsSync(path.join(root, candidate)));
|
|
@@ -1910,7 +1905,7 @@ function planViteMigration(root, mayConfigureVitePlusLint) {
|
|
|
1910
1905
|
};
|
|
1911
1906
|
}
|
|
1912
1907
|
function canInjectVitePlusLint(source) {
|
|
1913
|
-
if (!/from\s+["']vite-plus["']/u.test(source) || /^\s*lint\s*:/mu.test(source) || /\
|
|
1908
|
+
if (!/from\s+["']vite-plus["']/u.test(source) || /^\s*lint\s*:/mu.test(source) || /\bcreateVizeLintConfig\b/u.test(source)) return false;
|
|
1914
1909
|
return [...source.matchAll(/\bdefineConfig\s*\(\s*\{/gu)].length === 1;
|
|
1915
1910
|
}
|
|
1916
1911
|
function injectVitePlusLint(source) {
|