oxlint-tui 1.0.11 → 1.0.13
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 +18 -7
package/package.json
CHANGED
package/tui.js
CHANGED
|
@@ -96,23 +96,34 @@ function runLint(type_aware) {
|
|
|
96
96
|
: `npx -q --yes --package oxlint@${OXLINT_VERSION} -- oxlint`;
|
|
97
97
|
|
|
98
98
|
exec(cmd, (error, stdout, stderr) => {
|
|
99
|
-
const fullOutput = stdout + stderr;
|
|
100
|
-
|
|
101
|
-
const summaryMatch = fullOutput.match(/Found (\d+) warnings? and (\d+) errors?/i);
|
|
102
|
-
|
|
103
99
|
state.isLinting = false;
|
|
104
100
|
|
|
101
|
+
const summaryMatch = stdout.match(/Found (\d+) warnings? and (\d+) errors?/i);
|
|
102
|
+
|
|
105
103
|
if (summaryMatch) {
|
|
106
104
|
state.message = summaryMatch[0].trim();
|
|
107
105
|
const errors = parseInt(summaryMatch[2]);
|
|
108
106
|
state.messageType = errors > 0 ? "error" : "warn";
|
|
109
|
-
}
|
|
107
|
+
}
|
|
108
|
+
else if (stdout.includes("Finished") || (!error && stdout.trim() === "")) {
|
|
110
109
|
state.message = "Linting passed! 0 issues found.";
|
|
111
110
|
state.messageType = "success";
|
|
112
|
-
}
|
|
113
|
-
|
|
111
|
+
}
|
|
112
|
+
else if (error || stderr.trim().length > 0) {
|
|
113
|
+
const realErrors = stderr
|
|
114
|
+
.split('\n')
|
|
115
|
+
.filter(line => !line.includes("JS plugins are experimental"))
|
|
116
|
+
.join(' ')
|
|
117
|
+
.trim();
|
|
118
|
+
|
|
119
|
+
state.message = realErrors ? `Error: ${realErrors.substring(0, 50)}` : "Linting failed";
|
|
114
120
|
state.messageType = "error";
|
|
115
121
|
}
|
|
122
|
+
else {
|
|
123
|
+
state.message = "Unknown state";
|
|
124
|
+
state.messageType = "dim";
|
|
125
|
+
}
|
|
126
|
+
|
|
116
127
|
render();
|
|
117
128
|
});
|
|
118
129
|
}
|