oxlint-tui 1.0.12 → 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 -5
package/package.json
CHANGED
package/tui.js
CHANGED
|
@@ -96,21 +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 summaryMatch = stdout.match(/Found (\d+) warnings? and (\d+) errors?/i);
|
|
100
|
-
|
|
101
99
|
state.isLinting = false;
|
|
102
100
|
|
|
101
|
+
const summaryMatch = stdout.match(/Found (\d+) warnings? and (\d+) errors?/i);
|
|
102
|
+
|
|
103
103
|
if (summaryMatch) {
|
|
104
104
|
state.message = summaryMatch[0].trim();
|
|
105
105
|
const errors = parseInt(summaryMatch[2]);
|
|
106
106
|
state.messageType = errors > 0 ? "error" : "warn";
|
|
107
|
-
}
|
|
107
|
+
}
|
|
108
|
+
else if (stdout.includes("Finished") || (!error && stdout.trim() === "")) {
|
|
108
109
|
state.message = "Linting passed! 0 issues found.";
|
|
109
110
|
state.messageType = "success";
|
|
110
|
-
}
|
|
111
|
-
|
|
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";
|
|
112
120
|
state.messageType = "error";
|
|
113
121
|
}
|
|
122
|
+
else {
|
|
123
|
+
state.message = "Unknown state";
|
|
124
|
+
state.messageType = "dim";
|
|
125
|
+
}
|
|
126
|
+
|
|
114
127
|
render();
|
|
115
128
|
});
|
|
116
129
|
}
|