summaryrefslogtreecommitdiff
path: root/tools/lint.js
diff options
context:
space:
mode:
authorLuca Casonato <hello@lcas.dev>2023-09-26 13:41:07 +0900
committerGitHub <noreply@github.com>2023-09-26 04:41:07 +0000
commit6f87962a77f3dd409c71ff490fd5f36023b7b700 (patch)
treebc515dfb5b7257d037c1bfea32ab6daaf6fcc122 /tools/lint.js
parent939279aa1075aab9b647e9a149df31da346fa7f2 (diff)
chore: clean up lint script (#20682)
Right now, if one of the linters fails, the all other ones continue running in the background. This fixes this by waiting until all linters are done before settling.
Diffstat (limited to 'tools/lint.js')
-rwxr-xr-xtools/lint.js38
1 files changed, 23 insertions, 15 deletions
diff --git a/tools/lint.js b/tools/lint.js
index 78fc7a84c..396a68767 100755
--- a/tools/lint.js
+++ b/tools/lint.js
@@ -3,26 +3,34 @@
import { buildMode, getPrebuilt, getSources, join, ROOT_PATH } from "./util.js";
import { checkCopyright } from "./copyright_checker.js";
-let didLint = false;
+const promises = [];
-if (Deno.args.includes("--js")) {
- await dlint();
- await dlintPreferPrimordials();
- didLint = true;
+let js = Deno.args.includes("--js");
+let rs = Deno.args.includes("--rs");
+if (!js && !rs) {
+ js = true;
+ rs = true;
}
-if (Deno.args.includes("--rs")) {
- await clippy();
- didLint = true;
+if (js) {
+ promises.push(dlint());
+ promises.push(dlintPreferPrimordials());
}
-if (!didLint) {
- await Promise.all([
- dlint(),
- dlintPreferPrimordials(),
- checkCopyright(),
- clippy(),
- ]);
+if (rs) {
+ promises.push(clippy());
+}
+
+if (!js && !rs) {
+ promises.push(checkCopyright());
+}
+
+const results = await Promise.allSettled(promises);
+for (const result of results) {
+ if (result.status === "rejected") {
+ console.error(result.reason);
+ Deno.exit(1);
+ }
}
async function dlint() {