oxlint-plugin-vize 0.719.0 → 0.720.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 +5 -3
- package/dist/cli.mjs +250 -25
- package/dist/{configs-BR5ECvTV.d.mts → configs-C1P9iomw.d.mts} +12 -0
- package/dist/{configs-DcZgPDfG.mjs → configs-CRRkC_Gm.mjs} +8 -0
- package/dist/eslint.d.mts +1 -1
- package/dist/eslint.mjs +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +11 -11
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@ This package lets Oxlint execute Patina through Vize's native binding while stil
|
|
|
6
6
|
|
|
7
7
|
> [!IMPORTANT]
|
|
8
8
|
> `oxlint-plugin-vize` is a terminal-first Vue SFC linting package.
|
|
9
|
-
> Until upstream Vue support in Oxlint matures, use `oxlint-vize` for original SFC locations in terminal and
|
|
9
|
+
> Until upstream Vue support in Oxlint matures, use `oxlint-vize` for original SFC locations in terminal, JSON, GitHub, and GitLab output. Direct `oxlint` still has JS plugin location limits.
|
|
10
10
|
|
|
11
11
|
## Main Features
|
|
12
12
|
|
|
@@ -261,13 +261,15 @@ vp exec oxlint-vize -c .oxlintrc.json -f stylish src
|
|
|
261
261
|
|
|
262
262
|
`oxlint-vize` appends a temporary `<script setup>` location bridge for Vue and HTML files, including files with existing scripts. This lets Patina report the original SFC line and column through Oxlint's JS plugin pipeline. The wrapper rewrites temporary paths back to the original files; `-f json` retains those original positions for machine-readable diagnostics.
|
|
263
263
|
|
|
264
|
+
For CI annotations and code-quality artifacts, `-f github` and `-f gitlab` are generated from that same merged JSON report. This keeps one summary and preserves original Vue paths and ranges even when a lint run uses multiple internal phases.
|
|
265
|
+
|
|
264
266
|
### Oxlint type-aware rules in Vue files
|
|
265
267
|
|
|
266
268
|
Oxlint's own type-aware rules (`typescript/no-floating-promises`, `typescript/no-misused-promises` and the rest of the tsgolint set) do not look inside `.vue` files. When you run `oxlint-vize --type-aware`, or your `.oxlintrc.json` sets `options.typeAware: true`, the wrapper runs those rules on each SFC's `<script>` and `<script setup>` blocks too, with the severities from your resolved configuration, and reports them at the original `.vue` lines and columns. Imports between `.vue` and `.ts` files resolve as they do for TypeScript. Template expressions are not part of this pass; Vize's `vize/type/*` rules cover them.
|
|
267
269
|
|
|
268
270
|
## Limitations
|
|
269
271
|
|
|
270
|
-
- The type-aware pass for Vue script blocks
|
|
272
|
+
- The type-aware pass for Vue script blocks applies root `overrides` and `excludeFiles` to the original `.vue` path before checking its temporary script shim. Nested configs still do not change which type-aware rules run on Vue files. Your `tsconfig.json` must include the `.vue` files' directories with a `**/*.ts` pattern, because each SFC is checked through a temporary `Component.vue.ts` sibling that is removed after the run.
|
|
271
273
|
- Raw `oxlint` still misses files without `<script>` or `<script setup>`. It also anchors template diagnostics to an extracted script instead of the original template location. Use `oxlint-vize` when linting Vue and HTML files.
|
|
272
274
|
- The wrapper's temporary files are not copied back when Oxlint fix flags are used; it warns when `--fix` or `--fix-suggestions` is passed.
|
|
273
275
|
- With Oxlint 1.78, complete explicit/discovered JSON configs containing `ignorePatterns` or `overrides`, and root TS/MTS configs with object `extends`, the wrapper retains original file selection and ordered Vue overrides. This mode supports POSIX paths; inherited JSON configs, import/type-aware project resolution, suppression state, ambiguous filenames, unsupported outside-root patterns and unknown option forms produce actionable errors.
|
|
@@ -279,5 +281,5 @@ Oxlint's own type-aware rules (`typescript/no-floating-promises`, `typescript/no
|
|
|
279
281
|
## Current expectations
|
|
280
282
|
|
|
281
283
|
- This release is meant for terminal-first workflows.
|
|
282
|
-
- The `oxlint-vize` wrapper reports original Patina positions in `stylish` and `
|
|
284
|
+
- The `oxlint-vize` wrapper reports original Patina positions in `stylish`, `json`, `github`, and `gitlab`; direct `oxlint` remains limited by its extracted-script JS plugin input.
|
|
283
285
|
- Once Oxlint preserves original Vue positions for JS plugins, the temporary location bridge can be removed.
|
package/dist/cli.mjs
CHANGED
|
@@ -75,6 +75,8 @@ const BOOLEAN_OPTIONS = new Set([
|
|
|
75
75
|
const ALWAYS_REPORTING_FORMATS = new Set([
|
|
76
76
|
"checkstyle",
|
|
77
77
|
"default",
|
|
78
|
+
"github",
|
|
79
|
+
"gitlab",
|
|
78
80
|
"json",
|
|
79
81
|
"junit"
|
|
80
82
|
]);
|
|
@@ -156,11 +158,14 @@ function collectVueLikeFilesFromTarget(cwd, target, onCandidate) {
|
|
|
156
158
|
}).map((entry) => observe(path.resolve(cwd, entry))).filter(isSupportedLintFile);
|
|
157
159
|
if (!fs.existsSync(absoluteTarget)) return [];
|
|
158
160
|
const stat = fs.statSync(absoluteTarget);
|
|
159
|
-
if (stat.isDirectory())
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
161
|
+
if (stat.isDirectory()) {
|
|
162
|
+
const files = [];
|
|
163
|
+
walkDirectoryFiles(absoluteTarget, (file) => {
|
|
164
|
+
observe(file);
|
|
165
|
+
if (isSupportedLintFile(file)) files.push(file);
|
|
166
|
+
});
|
|
167
|
+
return files;
|
|
168
|
+
}
|
|
164
169
|
return stat.isFile() && hasVueLikeExtension(absoluteTarget) ? [absoluteTarget] : [];
|
|
165
170
|
}
|
|
166
171
|
function isSupportedLintFile(filename) {
|
|
@@ -171,6 +176,48 @@ function isSupportedLintFile(filename) {
|
|
|
171
176
|
return false;
|
|
172
177
|
}
|
|
173
178
|
}
|
|
179
|
+
/**
|
|
180
|
+
* Visit the same filesystem domain as a directory lint target, including dot
|
|
181
|
+
* entries selected by Oxlint. Real directory identities bound symlink cycles;
|
|
182
|
+
* unreadable or concurrently removed entries cannot invalidate other files.
|
|
183
|
+
*/
|
|
184
|
+
function walkDirectoryFiles(directory, visit) {
|
|
185
|
+
const pending = [directory];
|
|
186
|
+
const visitedDirectories = /* @__PURE__ */ new Set();
|
|
187
|
+
while (pending.length > 0) {
|
|
188
|
+
const current = pending.pop();
|
|
189
|
+
let identity;
|
|
190
|
+
let entries;
|
|
191
|
+
try {
|
|
192
|
+
identity = fs.realpathSync(current);
|
|
193
|
+
if (visitedDirectories.has(identity)) continue;
|
|
194
|
+
visitedDirectories.add(identity);
|
|
195
|
+
entries = fs.readdirSync(current, { withFileTypes: true });
|
|
196
|
+
} catch {
|
|
197
|
+
continue;
|
|
198
|
+
}
|
|
199
|
+
for (const entry of entries) {
|
|
200
|
+
if (entry.name === ".git" || entry.name === "node_modules") continue;
|
|
201
|
+
const file = path.join(current, entry.name);
|
|
202
|
+
if (entry.isDirectory()) {
|
|
203
|
+
visit(file);
|
|
204
|
+
pending.push(file);
|
|
205
|
+
continue;
|
|
206
|
+
}
|
|
207
|
+
if (!entry.isSymbolicLink()) {
|
|
208
|
+
if (entry.isFile()) visit(file);
|
|
209
|
+
continue;
|
|
210
|
+
}
|
|
211
|
+
try {
|
|
212
|
+
const target = fs.statSync(file);
|
|
213
|
+
if (target.isDirectory()) {
|
|
214
|
+
visit(file);
|
|
215
|
+
pending.push(file);
|
|
216
|
+
} else if (target.isFile()) visit(file);
|
|
217
|
+
} catch {}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
174
221
|
//#endregion
|
|
175
222
|
//#region src/cli/oxlint.ts
|
|
176
223
|
const OXLINT_ENTRYPOINT_SEGMENTS = [
|
|
@@ -1563,22 +1610,52 @@ function buildScriptShim(source) {
|
|
|
1563
1610
|
}
|
|
1564
1611
|
/** The user's resolved config, reduced to its enabled type-aware rules. */
|
|
1565
1612
|
function typeAwareOnlyConfig(printed, typeAwareRules) {
|
|
1566
|
-
const rules =
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
if (!typeAwareRules.has(name) || severity === "off" || severity === "allow" || severity === 0) continue;
|
|
1570
|
-
rules[name] = value;
|
|
1571
|
-
}
|
|
1572
|
-
if (Object.keys(rules).length === 0) return null;
|
|
1613
|
+
const rules = typeAwareRuleEntries(printed.rules, typeAwareRules);
|
|
1614
|
+
const overrides = Array.isArray(printed.overrides) ? printed.overrides.flatMap((override) => typeAwareOverride(override, typeAwareRules)) : [];
|
|
1615
|
+
if (!hasEnabledRule(rules) && !overrides.some((override) => hasEnabledRule(override.rules))) return null;
|
|
1573
1616
|
return {
|
|
1574
1617
|
plugins: printed.plugins ?? [],
|
|
1575
1618
|
categories: Object.fromEntries(CATEGORIES.map((category) => [category, "off"])),
|
|
1576
1619
|
rules,
|
|
1620
|
+
overrides,
|
|
1577
1621
|
settings: printed.settings ?? {},
|
|
1578
1622
|
env: printed.env ?? {},
|
|
1579
1623
|
globals: printed.globals ?? {}
|
|
1580
1624
|
};
|
|
1581
1625
|
}
|
|
1626
|
+
const SCRIPT_SHIM_EXTENSIONS = [
|
|
1627
|
+
".ts",
|
|
1628
|
+
".tsx",
|
|
1629
|
+
".js",
|
|
1630
|
+
".jsx"
|
|
1631
|
+
];
|
|
1632
|
+
function typeAwareRuleEntries(value, typeAwareRules) {
|
|
1633
|
+
if (value == null || typeof value !== "object" || Array.isArray(value)) return {};
|
|
1634
|
+
return Object.fromEntries(Object.entries(value).filter(([name]) => typeAwareRules.has(name)));
|
|
1635
|
+
}
|
|
1636
|
+
function typeAwareOverride(value, typeAwareRules) {
|
|
1637
|
+
if (value == null || typeof value !== "object" || Array.isArray(value)) return [];
|
|
1638
|
+
const override = value;
|
|
1639
|
+
const files = projectGlobsToScriptShims(override.files);
|
|
1640
|
+
const rules = typeAwareRuleEntries(override.rules, typeAwareRules);
|
|
1641
|
+
if (files.length === 0 || Object.keys(rules).length === 0) return [];
|
|
1642
|
+
const excludeFiles = projectGlobsToScriptShims(override.excludeFiles);
|
|
1643
|
+
return [{
|
|
1644
|
+
files,
|
|
1645
|
+
...excludeFiles.length > 0 ? { excludeFiles } : {},
|
|
1646
|
+
rules
|
|
1647
|
+
}];
|
|
1648
|
+
}
|
|
1649
|
+
function projectGlobsToScriptShims(value) {
|
|
1650
|
+
if (!Array.isArray(value)) return [];
|
|
1651
|
+
return value.flatMap((glob) => typeof glob === "string" ? SCRIPT_SHIM_EXTENSIONS.map((extension) => `${glob}${extension}`) : []);
|
|
1652
|
+
}
|
|
1653
|
+
function hasEnabledRule(rules) {
|
|
1654
|
+
return Object.values(rules).some((value) => {
|
|
1655
|
+
const severity = Array.isArray(value) ? value[0] : value;
|
|
1656
|
+
return severity !== "off" && severity !== "allow" && severity !== 0;
|
|
1657
|
+
});
|
|
1658
|
+
}
|
|
1582
1659
|
/** Lint the SFC script shims with the user's type-aware rules; undefined when nothing applies. */
|
|
1583
1660
|
async function runVueTypeAwarePass(cwd, entrypoint, forwardedArgs, vueFiles, run) {
|
|
1584
1661
|
const sfcFiles = vueFiles.filter((file) => file.endsWith(".vue") && !isStandaloneHtmlFile(file));
|
|
@@ -1602,13 +1679,10 @@ async function runVueTypeAwarePass(cwd, entrypoint, forwardedArgs, vueFiles, run
|
|
|
1602
1679
|
if (config == null) return void 0;
|
|
1603
1680
|
const created = [];
|
|
1604
1681
|
const replacements = /* @__PURE__ */ new Map();
|
|
1605
|
-
const
|
|
1682
|
+
const configPath = path.join(selectedConfigDirectory(options, cwd), `.oxlint-vize-type-aware-${randomUUID()}.json`);
|
|
1606
1683
|
const cleanup = () => {
|
|
1607
1684
|
for (const file of created) fs.rmSync(file, { force: true });
|
|
1608
|
-
fs.rmSync(
|
|
1609
|
-
force: true,
|
|
1610
|
-
recursive: true
|
|
1611
|
-
});
|
|
1685
|
+
fs.rmSync(configPath, { force: true });
|
|
1612
1686
|
};
|
|
1613
1687
|
process.once("exit", cleanup);
|
|
1614
1688
|
try {
|
|
@@ -1622,8 +1696,7 @@ async function runVueTypeAwarePass(cwd, entrypoint, forwardedArgs, vueFiles, run
|
|
|
1622
1696
|
registerPathReplacementVariants(replacements, cwd, shimPath, file);
|
|
1623
1697
|
}
|
|
1624
1698
|
if (created.length === 0) return void 0;
|
|
1625
|
-
|
|
1626
|
-
fs.writeFileSync(configPath, JSON.stringify(config));
|
|
1699
|
+
fs.writeFileSync(configPath, JSON.stringify(config), { flag: "wx" });
|
|
1627
1700
|
const result = await run([
|
|
1628
1701
|
entrypoint,
|
|
1629
1702
|
...passOptions(options),
|
|
@@ -1656,6 +1729,15 @@ function keepConfigSelection(options) {
|
|
|
1656
1729
|
}
|
|
1657
1730
|
return kept;
|
|
1658
1731
|
}
|
|
1732
|
+
function selectedConfigDirectory(options, cwd) {
|
|
1733
|
+
let configPath;
|
|
1734
|
+
for (let index = 0; index < options.length; index += 1) {
|
|
1735
|
+
const option = options[index];
|
|
1736
|
+
if (option === "-c" || option === "--config") configPath = options[++index];
|
|
1737
|
+
else if (option.startsWith("--config=")) configPath = option.slice(9);
|
|
1738
|
+
}
|
|
1739
|
+
return configPath == null ? cwd : path.dirname(path.resolve(cwd, configPath));
|
|
1740
|
+
}
|
|
1659
1741
|
function passOptions(options) {
|
|
1660
1742
|
const kept = [];
|
|
1661
1743
|
for (let index = 0; index < options.length; index += 1) {
|
|
@@ -1695,10 +1777,152 @@ function stripJsonComments(text) {
|
|
|
1695
1777
|
return result;
|
|
1696
1778
|
}
|
|
1697
1779
|
//#endregion
|
|
1780
|
+
//#region src/cli/report-format.ts
|
|
1781
|
+
/** The last requested wrapper-owned format before `--`, when conversion is required. */
|
|
1782
|
+
function requestedConvertedFormat(args) {
|
|
1783
|
+
let format;
|
|
1784
|
+
for (let index = 0; index < args.length && args[index] !== "--"; index += 1) {
|
|
1785
|
+
const arg = args[index];
|
|
1786
|
+
if (arg === "-f" || arg === "--format") format = args[++index];
|
|
1787
|
+
else if (arg.startsWith("--format=")) format = arg.slice(9);
|
|
1788
|
+
}
|
|
1789
|
+
return format === "github" || format === "gitlab" ? format : void 0;
|
|
1790
|
+
}
|
|
1791
|
+
/** Preserve all CLI spelling and ordering while making the internal report mergeable. */
|
|
1792
|
+
function withJsonReport(args) {
|
|
1793
|
+
const result = [...args];
|
|
1794
|
+
for (let index = 0; index < result.length && result[index] !== "--"; index += 1) {
|
|
1795
|
+
const arg = result[index];
|
|
1796
|
+
if (arg === "-f" || arg === "--format") {
|
|
1797
|
+
if (result[index + 1] != null) result[index + 1] = "json";
|
|
1798
|
+
index += 1;
|
|
1799
|
+
} else if (arg.startsWith("--format=")) result[index] = "--format=json";
|
|
1800
|
+
}
|
|
1801
|
+
return result;
|
|
1802
|
+
}
|
|
1803
|
+
function renderConvertedReport(stdout, format, cwd) {
|
|
1804
|
+
const report = parseReport(stdout);
|
|
1805
|
+
return format === "github" ? renderGitHub(report, cwd) : renderGitLab(report, cwd);
|
|
1806
|
+
}
|
|
1807
|
+
function parseReport(stdout) {
|
|
1808
|
+
const value = JSON.parse(stdout);
|
|
1809
|
+
if (value == null || !Array.isArray(value.diagnostics) || !finite(value.number_of_files) || !finite(value.number_of_rules) || !finite(value.threads_count) || !finite(value.start_time)) throw new Error("GitHub and GitLab output require a complete Oxlint JSON report.");
|
|
1810
|
+
for (const diagnostic of value.diagnostics) if (diagnostic == null || typeof diagnostic !== "object" || typeof diagnostic.message !== "string" || typeof diagnostic.severity !== "string") throw new Error("GitHub and GitLab output received an incomplete Oxlint diagnostic.");
|
|
1811
|
+
return value;
|
|
1812
|
+
}
|
|
1813
|
+
function renderGitHub(report, cwd) {
|
|
1814
|
+
const diagnostics = report.diagnostics.map((diagnostic) => githubAnnotation(diagnostic, cwd));
|
|
1815
|
+
const errors = report.diagnostics.filter((diagnostic) => diagnostic.severity === "error").length;
|
|
1816
|
+
const warnings = report.diagnostics.length - errors;
|
|
1817
|
+
const duration = report.start_time < 1 ? `${Math.floor(report.start_time * 1e3)}ms` : `${report.start_time.toFixed(1)}s`;
|
|
1818
|
+
const summary = [`Found ${warnings} warning${warnings === 1 ? "" : "s"} and ${errors} error${errors === 1 ? "" : "s"}.`, `Finished in ${duration} on ${report.number_of_files} file${report.number_of_files === 1 ? "" : "s"} with ${report.number_of_rules} rules using ${report.threads_count} threads.`].join("\n");
|
|
1819
|
+
return `${diagnostics.length > 0 ? `${diagnostics.join("\n")}\n\n` : ""}${summary}\n`;
|
|
1820
|
+
}
|
|
1821
|
+
function githubAnnotation(diagnostic, cwd) {
|
|
1822
|
+
const span = primarySpan(diagnostic);
|
|
1823
|
+
const filename = diagnostic.filename == null ? void 0 : displayPath(diagnostic.filename, cwd);
|
|
1824
|
+
const end = span == null || diagnostic.filename == null ? void 0 : endPosition(diagnostic.filename, span, cwd);
|
|
1825
|
+
const properties = [];
|
|
1826
|
+
if (filename != null) properties.push(["file", filename]);
|
|
1827
|
+
if (span != null) {
|
|
1828
|
+
properties.push(["line", span.line], ["endLine", end?.line ?? span.line]);
|
|
1829
|
+
properties.push(["col", span.column], ["endColumn", end?.column ?? span.column]);
|
|
1830
|
+
}
|
|
1831
|
+
properties.push(["title", diagnostic.code ?? "oxlint"]);
|
|
1832
|
+
const encoded = properties.map(([name, value]) => `${name}=${escapeCommandProperty(String(value))}`).join(",");
|
|
1833
|
+
const location = filename != null && span != null ? `${filename}:${span.line}:${span.column}: ` : "";
|
|
1834
|
+
return `::${diagnostic.severity === "error" ? "error" : "warning"} ${encoded}::${escapeCommandData(`${location}${diagnostic.message}`)}`;
|
|
1835
|
+
}
|
|
1836
|
+
function renderGitLab(report, cwd) {
|
|
1837
|
+
const rows = report.diagnostics.map((diagnostic) => {
|
|
1838
|
+
const span = primarySpan(diagnostic);
|
|
1839
|
+
const filename = diagnostic.filename == null ? "" : displayPath(diagnostic.filename, cwd);
|
|
1840
|
+
const end = span == null || diagnostic.filename == null ? void 0 : endPosition(diagnostic.filename, span, cwd);
|
|
1841
|
+
const identity = JSON.stringify([
|
|
1842
|
+
filename,
|
|
1843
|
+
diagnostic.code ?? "oxlint",
|
|
1844
|
+
diagnostic.message,
|
|
1845
|
+
span?.line ?? 1,
|
|
1846
|
+
end?.line ?? span?.line ?? 1,
|
|
1847
|
+
diagnostic.severity
|
|
1848
|
+
]);
|
|
1849
|
+
return {
|
|
1850
|
+
description: diagnostic.message,
|
|
1851
|
+
check_name: diagnostic.code ?? "oxlint",
|
|
1852
|
+
fingerprint: createHash("sha256").update(identity).digest("hex").slice(0, 16),
|
|
1853
|
+
severity: diagnostic.severity === "error" ? "critical" : diagnostic.severity === "warning" ? "major" : "minor",
|
|
1854
|
+
location: {
|
|
1855
|
+
path: filename,
|
|
1856
|
+
lines: {
|
|
1857
|
+
begin: span?.line ?? 1,
|
|
1858
|
+
end: end?.line ?? span?.line ?? 1
|
|
1859
|
+
}
|
|
1860
|
+
}
|
|
1861
|
+
};
|
|
1862
|
+
});
|
|
1863
|
+
return `${JSON.stringify(rows, null, 2)}\n`;
|
|
1864
|
+
}
|
|
1865
|
+
function primarySpan(diagnostic) {
|
|
1866
|
+
const span = diagnostic.labels?.[0]?.span;
|
|
1867
|
+
return span != null && [
|
|
1868
|
+
span.offset,
|
|
1869
|
+
span.length,
|
|
1870
|
+
span.line,
|
|
1871
|
+
span.column
|
|
1872
|
+
].every(Number.isSafeInteger) ? span : void 0;
|
|
1873
|
+
}
|
|
1874
|
+
function endPosition(filename, span, cwd) {
|
|
1875
|
+
try {
|
|
1876
|
+
const bytes = fs.readFileSync(path.resolve(cwd, filename));
|
|
1877
|
+
const endOffset = Math.min(span.offset + span.length, bytes.length);
|
|
1878
|
+
const before = bytes.subarray(0, endOffset).toString("utf8");
|
|
1879
|
+
if (!Buffer.from(before, "utf8").equals(bytes.subarray(0, endOffset))) return {
|
|
1880
|
+
line: span.line,
|
|
1881
|
+
column: span.column
|
|
1882
|
+
};
|
|
1883
|
+
const lines = before.split("\n");
|
|
1884
|
+
return {
|
|
1885
|
+
line: lines.length,
|
|
1886
|
+
column: (lines.at(-1)?.length ?? 0) + 1
|
|
1887
|
+
};
|
|
1888
|
+
} catch {
|
|
1889
|
+
return {
|
|
1890
|
+
line: span.line,
|
|
1891
|
+
column: span.column
|
|
1892
|
+
};
|
|
1893
|
+
}
|
|
1894
|
+
}
|
|
1895
|
+
function displayPath(filename, cwd) {
|
|
1896
|
+
const absolute = path.resolve(cwd, filename);
|
|
1897
|
+
const root = repositoryRoot(cwd);
|
|
1898
|
+
const relative = path.relative(root, absolute);
|
|
1899
|
+
return relative !== "" && !relative.startsWith(`..${path.sep}`) && relative !== ".." ? relative.split(path.sep).join("/") : filename.split(path.sep).join("/");
|
|
1900
|
+
}
|
|
1901
|
+
function repositoryRoot(cwd) {
|
|
1902
|
+
let current = path.resolve(cwd);
|
|
1903
|
+
while (true) {
|
|
1904
|
+
if (fs.existsSync(path.join(current, ".git"))) return current;
|
|
1905
|
+
const parent = path.dirname(current);
|
|
1906
|
+
if (parent === current) return path.resolve(cwd);
|
|
1907
|
+
current = parent;
|
|
1908
|
+
}
|
|
1909
|
+
}
|
|
1910
|
+
function escapeCommandProperty(value) {
|
|
1911
|
+
return escapeCommandData(value).replaceAll(":", "%3A").replaceAll(",", "%2C");
|
|
1912
|
+
}
|
|
1913
|
+
function escapeCommandData(value) {
|
|
1914
|
+
return value.replaceAll("%", "%25").replaceAll("\r", "%0D").replaceAll("\n", "%0A");
|
|
1915
|
+
}
|
|
1916
|
+
function finite(value) {
|
|
1917
|
+
return typeof value === "number" && Number.isFinite(value);
|
|
1918
|
+
}
|
|
1919
|
+
//#endregion
|
|
1698
1920
|
//#region src/cli.ts
|
|
1699
1921
|
async function main() {
|
|
1700
1922
|
const cwd = process.cwd();
|
|
1701
|
-
const
|
|
1923
|
+
const requestedArgs = process.argv.slice(2);
|
|
1924
|
+
const convertedFormat = requestedConvertedFormat(requestedArgs);
|
|
1925
|
+
const forwardedArgs = convertedFormat ? withJsonReport(requestedArgs) : requestedArgs;
|
|
1702
1926
|
const targets = getLintTargets(forwardedArgs);
|
|
1703
1927
|
const candidates = /* @__PURE__ */ new Set();
|
|
1704
1928
|
const lintFiles = collectVueLikeFilesFromTargets(cwd, targets, (file) => candidates.add(file));
|
|
@@ -1754,16 +1978,17 @@ async function main() {
|
|
|
1754
1978
|
}
|
|
1755
1979
|
throw error;
|
|
1756
1980
|
}
|
|
1757
|
-
const {
|
|
1758
|
-
if (
|
|
1759
|
-
if (stderr) await writeStream(process.stderr, merged.rawStderr ?? stderr);
|
|
1760
|
-
if (merged.status === 0 && stdout === "" && stderr === "" && expectsLintReport(forwardedArgs)) {
|
|
1981
|
+
const { stderr } = merged;
|
|
1982
|
+
if (merged.status === 0 && merged.stdout === "" && stderr === "" && expectsLintReport(requestedArgs)) {
|
|
1761
1983
|
await writeStream(process.stderr, `The oxlint run at ${oxlintEntrypoint} exited 0 but produced no report, although the requested format always emits one. Refusing to treat the silent run as a clean lint result.
|
|
1762
1984
|
`);
|
|
1763
1985
|
process.exitCode = 1;
|
|
1764
1986
|
return;
|
|
1765
1987
|
}
|
|
1766
|
-
|
|
1988
|
+
const stdout = convertedFormat ? renderConvertedReport(merged.stdout, convertedFormat, cwd) : merged.stdout;
|
|
1989
|
+
if (stdout) await writeStream(process.stdout, convertedFormat ? stdout : merged.rawStdout ?? stdout);
|
|
1990
|
+
if (stderr) await writeStream(process.stderr, merged.rawStderr ?? stderr);
|
|
1991
|
+
if (prepared.usedScriptlessWorkaround && (requestedArgs.includes("--fix") || requestedArgs.includes("--fix-suggestions"))) await writeStream(process.stderr, "\n[oxlint-plugin-vize] Temporary Vue workaround is active; fixes are not applied back to original files yet.\n");
|
|
1767
1992
|
process.exitCode = merged.status ?? 1;
|
|
1768
1993
|
} finally {
|
|
1769
1994
|
prepared.cleanup();
|
|
@@ -71,6 +71,18 @@ interface VizeRuleOptions {
|
|
|
71
71
|
casing?: CustomEventNameCasingOption;
|
|
72
72
|
};
|
|
73
73
|
"vue/no-mutating-props"?: NoMutatingPropsOption;
|
|
74
|
+
"vue/warn-custom-directive"?: {
|
|
75
|
+
ignore?: string[];
|
|
76
|
+
};
|
|
77
|
+
"vue/no-bare-strings-in-template"?: {
|
|
78
|
+
allowlist?: string[];
|
|
79
|
+
};
|
|
80
|
+
"a11y/anchor-has-content"?: {
|
|
81
|
+
accessibleChildren?: string[];
|
|
82
|
+
};
|
|
83
|
+
"a11y/label-has-for"?: {
|
|
84
|
+
controlComponents?: string[];
|
|
85
|
+
};
|
|
74
86
|
"vue/require-component-registration"?: {
|
|
75
87
|
globals?: string[];
|
|
76
88
|
};
|
|
@@ -284,6 +284,10 @@ function getRuleOptions(ruleName, options) {
|
|
|
284
284
|
case "type/strict-boolean-expressions":
|
|
285
285
|
case "script/no-restricted-globals":
|
|
286
286
|
case "script/no-restricted-members":
|
|
287
|
+
case "vue/warn-custom-directive":
|
|
288
|
+
case "vue/no-bare-strings-in-template":
|
|
289
|
+
case "a11y/anchor-has-content":
|
|
290
|
+
case "a11y/label-has-for":
|
|
287
291
|
case "vue/require-component-registration":
|
|
288
292
|
case "vue/valid-v-on":
|
|
289
293
|
case "vue/valid-v-slot":
|
|
@@ -997,6 +1001,10 @@ function ruleOptionsSchema(ruleName) {
|
|
|
997
1001
|
case "script/no-restricted-globals": return [restrictedGlobalsSchema()];
|
|
998
1002
|
case "script/no-restricted-members": return [restrictedMembersSchema()];
|
|
999
1003
|
case "vue/no-mutating-props": return [noMutatingPropsSchema()];
|
|
1004
|
+
case "vue/warn-custom-directive": return [objectSchema({ ignore: stringArraySchema() })];
|
|
1005
|
+
case "vue/no-bare-strings-in-template": return [objectSchema({ allowlist: stringArraySchema() })];
|
|
1006
|
+
case "a11y/anchor-has-content": return [objectSchema({ accessibleChildren: stringArraySchema() })];
|
|
1007
|
+
case "a11y/label-has-for": return [objectSchema({ controlComponents: stringArraySchema() })];
|
|
1000
1008
|
case "script/define-macros-order": return [defineMacrosOrderSchema()];
|
|
1001
1009
|
case "vue/sfc-element-order": return [sfcElementOrderSchema()];
|
|
1002
1010
|
case "vue/html-self-closing": return [htmlSelfClosingSchema()];
|
package/dist/eslint.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as createVizeRuleConfig, s as configs } from "./configs-
|
|
1
|
+
import { c as createVizeRuleConfig, s as configs } from "./configs-C1P9iomw.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-
|
|
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-CRRkC_Gm.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
|
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-
|
|
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-C1P9iomw.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-
|
|
1
|
+
import { c as getPatinaRules, n as createVizeRuleConfig, p as selectVizeRuleConfig, r as plugin_default, t as configs } from "./configs-CRRkC_Gm.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.
|
|
3
|
+
"version": "0.720.0",
|
|
4
4
|
"description": "Oxlint JS plugin bridge for Vize Patina",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"lint",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"@tsdown/css": "0.22.14",
|
|
52
52
|
"@types/node": "25.9.2",
|
|
53
53
|
"@typescript-eslint/parser": "8.72.1",
|
|
54
|
-
"@vizejs/native": "0.
|
|
54
|
+
"@vizejs/native": "0.720.0",
|
|
55
55
|
"ajv": "8.20.0",
|
|
56
56
|
"eslint": "10.14.0",
|
|
57
57
|
"eslint-plugin-vue": "10.12.0",
|
|
@@ -63,14 +63,14 @@
|
|
|
63
63
|
"vue-eslint-parser": "10.4.2"
|
|
64
64
|
},
|
|
65
65
|
"optionalDependencies": {
|
|
66
|
-
"@vizejs/native-darwin-arm64": "0.
|
|
67
|
-
"@vizejs/native-darwin-x64": "0.
|
|
68
|
-
"@vizejs/native-linux-arm64-gnu": "0.
|
|
69
|
-
"@vizejs/native-linux-arm64-musl": "0.
|
|
70
|
-
"@vizejs/native-linux-x64-gnu": "0.
|
|
71
|
-
"@vizejs/native-linux-x64-musl": "0.
|
|
72
|
-
"@vizejs/native-win32-arm64-msvc": "0.
|
|
73
|
-
"@vizejs/native-win32-x64-msvc": "0.
|
|
66
|
+
"@vizejs/native-darwin-arm64": "0.720.0",
|
|
67
|
+
"@vizejs/native-darwin-x64": "0.720.0",
|
|
68
|
+
"@vizejs/native-linux-arm64-gnu": "0.720.0",
|
|
69
|
+
"@vizejs/native-linux-arm64-musl": "0.720.0",
|
|
70
|
+
"@vizejs/native-linux-x64-gnu": "0.720.0",
|
|
71
|
+
"@vizejs/native-linux-x64-musl": "0.720.0",
|
|
72
|
+
"@vizejs/native-win32-arm64-msvc": "0.720.0",
|
|
73
|
+
"@vizejs/native-win32-x64-msvc": "0.720.0"
|
|
74
74
|
},
|
|
75
75
|
"engines": {
|
|
76
76
|
"node": "^22 || >= 24"
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
},
|
|
84
84
|
"scripts": {
|
|
85
85
|
"build": "vp pack",
|
|
86
|
-
"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/v-on-event-tuple-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 src/attribute-ignore-tags.test.ts && node src/eslint-acceptance.test.mjs && node src/v-on-event-autofix-host.test.ts && node src/v-on-event-tuple-eslint.test.ts && node src/attribute-eslint.test.ts && node src/prop-name-eslint.test.ts && node src/component-name-eslint.test.ts && node src/attribute-ignore-tags-eslint.test.ts && node src/attribute-ignore-tags-oxlint.test.ts",
|
|
86
|
+
"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/v-on-event-tuple-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/component-name-source.test.ts src/eslint-source.test.ts src/attribute-options.test.ts src/attribute-ignore-tags.test.ts src/cli/files-dotfiles.test.ts src/cli/oxlint.test.ts src/cli/report-format.test.ts src/cli/type-aware-vue.test.ts && node src/eslint-acceptance.test.mjs && node src/v-on-event-autofix-host.test.ts && node src/v-on-event-tuple-eslint.test.ts && node src/attribute-eslint.test.ts && node src/prop-name-eslint.test.ts && node src/component-name-eslint.test.ts && node src/attribute-ignore-tags-eslint.test.ts && node src/attribute-ignore-tags-oxlint.test.ts",
|
|
87
87
|
"check": "vp check src vite.config.ts",
|
|
88
88
|
"check:fix": "vp check --fix src vite.config.ts",
|
|
89
89
|
"fmt": "vp fmt --write src vite.config.ts"
|