oxlint-tui 1.0.9 → 1.0.11
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/package.json +1 -1
- package/tui.js +11 -11
package/package.json
CHANGED
package/tui.js
CHANGED
|
@@ -6,6 +6,7 @@ import readline from "readline";
|
|
|
6
6
|
import fs from "node:fs";
|
|
7
7
|
|
|
8
8
|
const OXLINT_VERSION = "1.41.0";
|
|
9
|
+
const TSGOLINT_VERSION = "0.11.1";
|
|
9
10
|
|
|
10
11
|
const COLORS = {
|
|
11
12
|
reset: "\x1b[0m",
|
|
@@ -90,27 +91,26 @@ function runLint(type_aware) {
|
|
|
90
91
|
state.messageType = "info";
|
|
91
92
|
render();
|
|
92
93
|
|
|
93
|
-
const cmd =
|
|
94
|
+
const cmd = type_aware
|
|
95
|
+
? `npx -q --yes --package oxlint@${OXLINT_VERSION} --package oxlint-tsgolint@${TSGOLINT_VERSION} -- oxlint --type-aware`
|
|
96
|
+
: `npx -q --yes --package oxlint@${OXLINT_VERSION} -- oxlint`;
|
|
94
97
|
|
|
95
98
|
exec(cmd, (error, stdout, stderr) => {
|
|
96
99
|
const fullOutput = stdout + stderr;
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
);
|
|
100
|
+
|
|
101
|
+
const summaryMatch = fullOutput.match(/Found (\d+) warnings? and (\d+) errors?/i);
|
|
100
102
|
|
|
101
103
|
state.isLinting = false;
|
|
104
|
+
|
|
102
105
|
if (summaryMatch) {
|
|
103
|
-
state.message = summaryMatch[0];
|
|
106
|
+
state.message = summaryMatch[0].trim();
|
|
104
107
|
const errors = parseInt(summaryMatch[2]);
|
|
105
108
|
state.messageType = errors > 0 ? "error" : "warn";
|
|
106
|
-
} else if (
|
|
107
|
-
fullOutput.includes("Finished") ||
|
|
108
|
-
(!error && fullOutput.length === 0)
|
|
109
|
-
) {
|
|
109
|
+
} else if (!error || (error.code === 0)) {
|
|
110
110
|
state.message = "Linting passed! 0 issues found.";
|
|
111
111
|
state.messageType = "success";
|
|
112
112
|
} else {
|
|
113
|
-
state.message =
|
|
113
|
+
state.message = `Error: ${stderr.split('\n')[0] || "Unknown issue"}`;
|
|
114
114
|
state.messageType = "error";
|
|
115
115
|
}
|
|
116
116
|
render();
|
|
@@ -238,7 +238,7 @@ function loadRules() {
|
|
|
238
238
|
|
|
239
239
|
try {
|
|
240
240
|
const raw = execSync(
|
|
241
|
-
`npx --yes oxlint@${OXLINT_VERSION} --rules --format=json`,
|
|
241
|
+
`npx -q --yes oxlint@${OXLINT_VERSION} --rules --format=json`,
|
|
242
242
|
{
|
|
243
243
|
encoding: "utf8",
|
|
244
244
|
stdio: ["ignore", "pipe", "ignore"],
|