oxlint-plugin-vize 0.626.0 → 0.628.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.
@@ -20,14 +20,176 @@ function hasOnlyKeys(value, keys) {
20
20
  return Object.keys(value).every((key) => keys.includes(key));
21
21
  }
22
22
  //#endregion
23
+ //#region src/v-on-event-options.ts
24
+ function isVOnEventHyphenationOptions(value) {
25
+ if (value === null || typeof value !== "object" || Array.isArray(value)) return false;
26
+ if (!Object.keys(value).every((key) => key === "style" || key === "ignore" || key === "autofix")) return false;
27
+ const option = value;
28
+ if (option.style !== void 0 && option.style !== "always" && option.style !== "never") return false;
29
+ if (option.autofix !== void 0 && typeof option.autofix !== "boolean") return false;
30
+ const ignore = option.ignore;
31
+ return ignore === void 0 || Array.isArray(ignore) && ignore.every((entry, index) => typeof entry === "string" && !/^\s*$/u.test(entry) && !entry.endsWith(":exit") && ignore.indexOf(entry) === index);
32
+ }
33
+ /** Match the canonical CLI shape while retaining the original style string. */
34
+ function vOnEventHyphenationSchema() {
35
+ return { oneOf: [{ enum: ["always", "never"] }, {
36
+ type: "object",
37
+ properties: {
38
+ style: { enum: ["always", "never"] },
39
+ autofix: { type: "boolean" },
40
+ ignore: {
41
+ type: "array",
42
+ uniqueItems: true,
43
+ items: {
44
+ type: "string",
45
+ pattern: "^(?!\\s*$)(?![\\s\\S]*:exit$)"
46
+ }
47
+ }
48
+ },
49
+ additionalProperties: false
50
+ }] };
51
+ }
52
+ //#endregion
53
+ //#region src/attribute-options.ts
54
+ function isIgnore(value) {
55
+ return value === void 0 || Array.isArray(value) && value.every((entry, index) => typeof entry === "string" && !/^\s*$/u.test(entry) && !entry.endsWith(":exit") && value.indexOf(entry) === index);
56
+ }
57
+ function isOptions(value, allowStyle) {
58
+ if (value === null || typeof value !== "object" || Array.isArray(value)) return false;
59
+ const options = value;
60
+ if (!Object.keys(options).every((key) => key === "ignore" || allowStyle && key === "style")) return false;
61
+ if (allowStyle && options.style !== void 0 && options.style !== "always" && options.style !== "never") return false;
62
+ return isIgnore(options.ignore);
63
+ }
64
+ /** Preserve the old style tuple; accept upstream's second ignore object and the canonical object. */
65
+ function getAttributeHyphenationOptions(options) {
66
+ if (options.length > 2) return void 0;
67
+ const first = options[0], second = options[1];
68
+ if (first === "always" || first === "never") {
69
+ if (second === void 0) return { attributeHyphenation: first };
70
+ if (!isOptions(second, false)) return void 0;
71
+ return {
72
+ attributeHyphenation: first,
73
+ attributeHyphenationIgnore: [...second.ignore ?? []]
74
+ };
75
+ }
76
+ if (isOptions(first, true) && second !== void 0) throw new TypeError("attribute-hyphenation accepts a canonical object or a style/ignore tuple, not both");
77
+ if (second === void 0 && isOptions(first, true)) return { ruleOptions: { "vue/attribute-hyphenation": structuredClone(first) } };
78
+ }
79
+ function ignoreSchema() {
80
+ return {
81
+ type: "array",
82
+ uniqueItems: true,
83
+ items: {
84
+ type: "string",
85
+ pattern: "^(?!\\s*$)(?![\\s\\S]*:exit$)"
86
+ }
87
+ };
88
+ }
89
+ function attributeHyphenationSchema() {
90
+ return [{ oneOf: [{ enum: ["always", "never"] }, {
91
+ type: "object",
92
+ properties: {
93
+ style: { enum: ["always", "never"] },
94
+ ignore: ignoreSchema()
95
+ },
96
+ additionalProperties: false
97
+ }] }, {
98
+ type: "object",
99
+ properties: { ignore: ignoreSchema() },
100
+ additionalProperties: false
101
+ }];
102
+ }
103
+ //#endregion
104
+ //#region src/prop-name-options.ts
105
+ function isStyle(value) {
106
+ return value === "camelCase" || value === "snake_case";
107
+ }
108
+ /** The upstream style tuple and the CLI's complete object share one native policy. */
109
+ function getPropNameCasingOptions(options) {
110
+ if (options.length !== 1) return void 0;
111
+ const first = options[0];
112
+ if (isStyle(first)) return { ruleOptions: { "vue/prop-name-casing": { casing: first } } };
113
+ if (isRecord(first) && hasOnlyKeys(first, ["casing"]) && (first.casing === void 0 || isStyle(first.casing))) return { ruleOptions: { "vue/prop-name-casing": structuredClone(first) } };
114
+ }
115
+ /** ignoreProps is outside the native policy; unknown keys/extra tuple options refuse. */
116
+ function propNameCasingSchema() {
117
+ return { oneOf: [{ enum: ["camelCase", "snake_case"] }, {
118
+ type: "object",
119
+ properties: { casing: { enum: ["camelCase", "snake_case"] } },
120
+ additionalProperties: false
121
+ }] };
122
+ }
123
+ //#endregion
124
+ //#region src/component-name-options.ts
125
+ function isCasing(value) {
126
+ return value === "PascalCase" || value === "kebab-case";
127
+ }
128
+ function isPolicy(value, canonical) {
129
+ return isRecord(value) && hasOnlyKeys(value, canonical ? [
130
+ "casing",
131
+ "registeredComponentsOnly",
132
+ "globals"
133
+ ] : ["registeredComponentsOnly", "globals"]) && (value.casing === void 0 || canonical && isCasing(value.casing)) && optionalBooleanField(value.registeredComponentsOnly) && (value.globals === void 0 || Array.isArray(value.globals) && value.globals.every((name) => typeof name === "string" && (canonical || !/^\/(.+)\/(.*)$/u.test(name))));
134
+ }
135
+ /** Preserve the original style field and forward the complete authored tuple policy. */
136
+ function getComponentNameCasingOptions(options) {
137
+ if (options.length === 1 && isCasing(options[0])) return { componentNameInTemplateCasing: options[0] };
138
+ if (options.length === 2 && isCasing(options[0]) && isPolicy(options[1], false)) return { ruleOptions: { "vue/component-name-in-template-casing": {
139
+ casing: options[0],
140
+ ...structuredClone(options[1])
141
+ } } };
142
+ if (options.length === 1 && isPolicy(options[0], true)) return { ruleOptions: { "vue/component-name-in-template-casing": structuredClone(options[0]) } };
143
+ }
144
+ /** The canonical policy is one item; only the official style can take a second item. */
145
+ function componentNameCasingSchema() {
146
+ const casing = { enum: ["PascalCase", "kebab-case"] };
147
+ const properties = {
148
+ registeredComponentsOnly: { type: "boolean" },
149
+ globals: {
150
+ type: "array",
151
+ items: { type: "string" }
152
+ }
153
+ };
154
+ return {
155
+ type: "array",
156
+ oneOf: [{
157
+ items: [casing, {
158
+ type: "object",
159
+ properties: {
160
+ ...properties,
161
+ globals: {
162
+ type: "array",
163
+ items: {
164
+ type: "string",
165
+ not: { pattern: "^/(.+)/(.*)$" }
166
+ }
167
+ }
168
+ },
169
+ additionalProperties: false
170
+ }],
171
+ maxItems: 2
172
+ }, {
173
+ items: [{
174
+ type: "object",
175
+ properties: {
176
+ casing,
177
+ ...properties
178
+ },
179
+ additionalProperties: false
180
+ }],
181
+ minItems: 1,
182
+ maxItems: 1
183
+ }]
184
+ };
185
+ }
186
+ //#endregion
23
187
  //#region src/rule-options.ts
24
188
  function getRuleOptions(ruleName, options) {
25
189
  const firstOption = options[0];
26
190
  switch (ruleName) {
27
- case "vue/component-name-in-template-casing":
28
- if (isComponentNameInTemplateCasingOption(firstOption)) return { componentNameInTemplateCasing: firstOption };
29
- if (isRecord(firstOption)) return cliRuleOptions(ruleName, firstOption);
30
- break;
191
+ case "vue/prop-name-casing": return getPropNameCasingOptions(options);
192
+ case "vue/component-name-in-template-casing": return getComponentNameCasingOptions(options);
31
193
  case "script/custom-event-name-casing":
32
194
  if (isCustomEventNameCasingOption(firstOption)) return { customEventNameCasing: firstOption };
33
195
  if (isRecord(firstOption)) return cliRuleOptions(ruleName, firstOption);
@@ -59,6 +221,7 @@ function getRuleOptions(ruleName, options) {
59
221
  break;
60
222
  case "vue/v-on-event-hyphenation":
61
223
  if (isHyphenationStyle(firstOption)) return { vOnEventHyphenation: firstOption };
224
+ if (isRecord(firstOption) && isVOnEventHyphenationOptions(firstOption)) return cliRuleOptions(ruleName, firstOption);
62
225
  break;
63
226
  case "vue/v-on-style":
64
227
  if (isVOnStyle(firstOption)) return { ruleOptions: { "vue/v-on-style": firstOption } };
@@ -69,9 +232,7 @@ function getRuleOptions(ruleName, options) {
69
232
  case "vue/v-bind-style":
70
233
  if (isVBindStyle(firstOption)) return { ruleOptions: { "vue/v-bind-style": firstOption } };
71
234
  break;
72
- case "vue/attribute-hyphenation":
73
- if (isHyphenationStyle(firstOption)) return { attributeHyphenation: firstOption };
74
- break;
235
+ case "vue/attribute-hyphenation": return getAttributeHyphenationOptions(options);
75
236
  case "script/define-props-destructuring":
76
237
  case "html/no-empty-palpable-content":
77
238
  case "type/strict-boolean-expressions":
@@ -93,9 +254,6 @@ function isDefineMacrosOrderOption(value) {
93
254
  function cliRuleOptions(ruleName, option) {
94
255
  return { ruleOptions: { [ruleName]: structuredClone(option) } };
95
256
  }
96
- function isComponentNameInTemplateCasingOption(value) {
97
- return value === "PascalCase" || value === "kebab-case";
98
- }
99
257
  function isCustomEventNameCasingOption(value) {
100
258
  return value === "camelCase" || value === "kebab-case";
101
259
  }
@@ -775,11 +933,8 @@ function createPatinaRule(ruleMeta) {
775
933
  }
776
934
  function ruleOptionsSchema(ruleName) {
777
935
  switch (ruleName) {
778
- case "vue/component-name-in-template-casing": return [{ oneOf: [{ enum: ["PascalCase", "kebab-case"] }, objectSchema({
779
- casing: { enum: ["PascalCase", "kebab-case"] },
780
- registeredComponentsOnly: { type: "boolean" },
781
- globals: stringArraySchema()
782
- })] }];
936
+ case "vue/prop-name-casing": return [propNameCasingSchema()];
937
+ case "vue/component-name-in-template-casing": return componentNameCasingSchema();
783
938
  case "script/custom-event-name-casing": return [{ oneOf: [{ enum: ["camelCase", "kebab-case"] }, objectSchema({ casing: { enum: ["camelCase", "kebab-case"] } })] }];
784
939
  case "script/define-props-destructuring": return [objectSchema({ destructure: { enum: [
785
940
  "only-when-assigned",
@@ -796,8 +951,8 @@ function ruleOptionsSchema(ruleName) {
796
951
  case "vue/html-self-closing": return [htmlSelfClosingSchema()];
797
952
  case "vue/html-quotes": return [{ enum: ["double", "single"] }, objectSchema({ avoidEscape: { type: "boolean" } })];
798
953
  case "vue/mustache-interpolation-spacing": return [{ enum: ["always", "never"] }];
799
- case "vue/v-on-event-hyphenation":
800
- case "vue/attribute-hyphenation": return [{ enum: ["always", "never"] }];
954
+ case "vue/v-on-event-hyphenation": return [vOnEventHyphenationSchema()];
955
+ case "vue/attribute-hyphenation": return attributeHyphenationSchema();
801
956
  case "vue/v-on-style": return [{ enum: ["shorthand", "longform"] }];
802
957
  case "vue/v-slot-style": return [{ oneOf: [{ enum: ["shorthand", "longform"] }, objectSchema({
803
958
  atComponent: { enum: [
@@ -1,3 +1,22 @@
1
+ //#region src/v-on-event-options.d.ts
2
+ interface VOnEventHyphenationOptions {
3
+ style?: HyphenationStyle;
4
+ ignore?: string[];
5
+ autofix?: boolean;
6
+ }
7
+ //#endregion
8
+ //#region src/attribute-options.d.ts
9
+ interface AttributeHyphenationOptions {
10
+ style?: HyphenationStyle;
11
+ ignore?: string[];
12
+ }
13
+ //#endregion
14
+ //#region src/prop-name-options.d.ts
15
+ type PropNameCasingStyle = "camelCase" | "snake_case";
16
+ interface PropNameCasingOptions {
17
+ casing?: PropNameCasingStyle;
18
+ }
19
+ //#endregion
1
20
  //#region src/model.d.ts
2
21
  type HelpLevel = "none" | "short" | "full";
3
22
  type PatinaPreset = "general-recommended" | "essential" | "ecosystem" | "incremental" | "opinionated" | "nuxt";
@@ -11,6 +30,7 @@ interface PatinaSettings {
11
30
  rules?: readonly string[] | Record<string, unknown>;
12
31
  }
13
32
  interface VizeRuleOptions {
33
+ "vue/prop-name-casing"?: PropNameCasingOptions;
14
34
  "script/define-props-destructuring"?: {
15
35
  destructure?: "only-when-assigned" | "always" | "never";
16
36
  };
@@ -56,11 +76,11 @@ interface VizeRuleOptions {
56
76
  "vue/html-self-closing"?: HtmlSelfClosingOption;
57
77
  "vue/html-quotes"?: HtmlQuotesConfig;
58
78
  "vue/mustache-interpolation-spacing"?: MustacheInterpolationSpacingStyle;
59
- "vue/v-on-event-hyphenation"?: HyphenationStyle;
79
+ "vue/v-on-event-hyphenation"?: HyphenationStyle | VOnEventHyphenationOptions;
60
80
  "vue/v-bind-style"?: VBindStyle;
61
81
  "vue/v-on-style"?: VOnStyle;
62
82
  "vue/v-slot-style"?: VSlotStyle;
63
- "vue/attribute-hyphenation"?: HyphenationStyle;
83
+ "vue/attribute-hyphenation"?: HyphenationStyle | AttributeHyphenationOptions;
64
84
  "vue/valid-v-on"?: {
65
85
  modifiers?: string[];
66
86
  };
package/dist/eslint.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { c as createVizeRuleConfig, s as configs } from "./configs-CF63Ev5C.mjs";
1
+ import { c as createVizeRuleConfig, s as configs } from "./configs-hcotHqwr.mjs";
2
2
 
3
3
  //#region src/eslint.d.ts
4
4
  /** ESLint rules over the complete source supplied by the configured parser. */
package/dist/eslint.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { c as getPatinaRules, d as isTypeAwareRuleName, f as createRuleSelection, i as formatPatinaMessage, l as getActivePreset, m as getRuleOptions, n as createVizeRuleConfig, o as diagnosticsForRule, r as plugin_default, s as indexDiagnosticsByRule, t as configs, u as getVizeSettings } from "./configs-BrKd8JK2.mjs";
1
+ import { c as getPatinaRules, d as isTypeAwareRuleName, f as createRuleSelection, i as formatPatinaMessage, l as getActivePreset, m as getRuleOptions, n as createVizeRuleConfig, o as diagnosticsForRule, r as plugin_default, s as indexDiagnosticsByRule, t as configs, u as getVizeSettings } from "./configs-DHeeem2c.mjs";
2
2
  import { d as isPatinaFile, m as loadBinding } from "./workaround-Byh3ja-i.mjs";
3
3
  import { definePlugin, defineRule, eslintCompatPlugin } from "@oxlint/plugins";
4
4
  //#region src/eslint-source.ts
@@ -66,6 +66,7 @@ function run(collected) {
66
66
  const selection = createRuleSelection(collected.options);
67
67
  const hasSelectedTypeAwareRule = selection.names.some(isTypeAwareRuleName);
68
68
  const settings = collected.settings;
69
+ const { ruleOptions, ...directRuleOptions } = selection.options;
69
70
  const result = loadBinding().lintPatinaSfc(collected.source, {
70
71
  filename: collected.filename,
71
72
  locale: settings.locale,
@@ -74,7 +75,8 @@ function run(collected) {
74
75
  enabledRules: selection.names,
75
76
  typeAware: settings.typeAware === true || hasSelectedTypeAwareRule,
76
77
  corsaPath: settings.corsaPath,
77
- ...selection.options,
78
+ ruleOptionsJson: ruleOptions ? JSON.stringify(ruleOptions) : void 0,
79
+ ...directRuleOptions,
78
80
  includeFixes: true
79
81
  });
80
82
  if (result.filename !== collected.filename) throw new Error("Vize returned diagnostics for another ESLint source");
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { a as VizeRuleConfigPreset, c as createVizeRuleConfig, d as VizeRuleOptions, i as VizeRuleConfigOptions, l as PatinaPreset, n as OxlintRuleEntry, o as VizeRuleConfigPresetInput, r as OxlintRuleSeverity, s as configs, t as OxlintRuleConfig, u as PatinaSettings } from "./configs-CF63Ev5C.mjs";
1
+ import { a as VizeRuleConfigPreset, c as createVizeRuleConfig, d as VizeRuleOptions, i as VizeRuleConfigOptions, l as PatinaPreset, n as OxlintRuleEntry, o as VizeRuleConfigPresetInput, r as OxlintRuleSeverity, s as configs, t as OxlintRuleConfig, u as PatinaSettings } from "./configs-hcotHqwr.mjs";
2
2
 
3
3
  //#region src/plugin.d.ts
4
4
  declare const _default: import("@oxlint/plugins").Plugin;
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { c as getPatinaRules, n as createVizeRuleConfig, p as selectVizeRuleConfig, r as plugin_default, t as configs } from "./configs-BrKd8JK2.mjs";
1
+ import { c as getPatinaRules, n as createVizeRuleConfig, p as selectVizeRuleConfig, r as plugin_default, t as configs } from "./configs-DHeeem2c.mjs";
2
2
  //#region src/vite-plus.ts
3
3
  /**
4
4
  * Bare specifier Oxlint uses to load this bridge as a JS plugin.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oxlint-plugin-vize",
3
- "version": "0.626.0",
3
+ "version": "0.628.0",
4
4
  "description": "Oxlint JS plugin bridge for Vize Patina",
5
5
  "keywords": [
6
6
  "lint",
@@ -48,21 +48,21 @@
48
48
  "devDependencies": {
49
49
  "@tsdown/css": "0.22.14",
50
50
  "@types/node": "25.9.2",
51
- "@vizejs/native": "0.626.0",
51
+ "@vizejs/native": "0.628.0",
52
52
  "tsdown": "0.22.14",
53
53
  "typescript": "6.0.3",
54
54
  "vite": "npm:@voidzero-dev/vite-plus-core@0.1.24",
55
55
  "vite-plus": "0.1.24"
56
56
  },
57
57
  "optionalDependencies": {
58
- "@vizejs/native-darwin-arm64": "0.626.0",
59
- "@vizejs/native-darwin-x64": "0.626.0",
60
- "@vizejs/native-linux-arm64-gnu": "0.626.0",
61
- "@vizejs/native-linux-arm64-musl": "0.626.0",
62
- "@vizejs/native-linux-x64-gnu": "0.626.0",
63
- "@vizejs/native-linux-x64-musl": "0.626.0",
64
- "@vizejs/native-win32-arm64-msvc": "0.626.0",
65
- "@vizejs/native-win32-x64-msvc": "0.626.0"
58
+ "@vizejs/native-darwin-arm64": "0.628.0",
59
+ "@vizejs/native-darwin-x64": "0.628.0",
60
+ "@vizejs/native-linux-arm64-gnu": "0.628.0",
61
+ "@vizejs/native-linux-arm64-musl": "0.628.0",
62
+ "@vizejs/native-linux-x64-gnu": "0.628.0",
63
+ "@vizejs/native-linux-x64-musl": "0.628.0",
64
+ "@vizejs/native-win32-arm64-msvc": "0.628.0",
65
+ "@vizejs/native-win32-x64-msvc": "0.628.0"
66
66
  },
67
67
  "engines": {
68
68
  "node": "^22 || >= 24"
@@ -75,7 +75,7 @@
75
75
  },
76
76
  "scripts": {
77
77
  "build": "vp pack",
78
- "test": "vp pack && vp test run src/file-state.test.ts src/batched-rules.test.ts src/script-safe-source.test.ts src/active-rule-collection.test.ts && node src/test.ts && node src/script-location.test.ts && node src/casing-options.test.ts && node src/router-globals.test.ts && node src/template-style-fixes.test.mjs && node src/html-binding.test.mjs && node --test src/eslint-source.test.ts && node src/eslint-acceptance.test.mjs",
78
+ "test": "vp pack && vp test run src/file-state.test.ts src/batched-rules.test.ts src/script-safe-source.test.ts src/active-rule-collection.test.ts src/v-on-event-options.test.ts src/prop-name-options.test.ts src/component-name-options.test.ts && node src/test.ts && node src/script-location.test.ts && node src/casing-options.test.ts && node src/router-globals.test.ts && node src/template-style-fixes.test.mjs && node src/html-binding.test.mjs && node --test src/eslint-source.test.ts src/attribute-options.test.ts && node src/eslint-acceptance.test.mjs && node src/v-on-event-autofix-host.test.ts && node src/attribute-eslint.test.ts && node src/prop-name-eslint.test.ts && node src/component-name-eslint.test.ts",
79
79
  "check": "vp check src vite.config.ts",
80
80
  "check:fix": "vp check --fix src vite.config.ts",
81
81
  "fmt": "vp fmt --write src vite.config.ts"