summaryrefslogtreecommitdiff
path: root/tools/lint.js
diff options
context:
space:
mode:
authorDavid Sherret <dsherret@users.noreply.github.com>2023-03-15 22:39:40 -0400
committerGitHub <noreply@github.com>2023-03-15 22:39:40 -0400
commit6c05b776e0c87ca825750ee67259c33a3ce10d0b (patch)
tree7f63dd77e110a6c42e68057e6bf931a5240cf83d /tools/lint.js
parent82ee73d795eb0d1c9b3ee226f069388b806a19b9 (diff)
chore: parallelize lint steps (#18214)
Diffstat (limited to 'tools/lint.js')
-rwxr-xr-xtools/lint.js39
1 files changed, 21 insertions, 18 deletions
diff --git a/tools/lint.js b/tools/lint.js
index 3e62bb844..36ab12e84 100755
--- a/tools/lint.js
+++ b/tools/lint.js
@@ -23,18 +23,18 @@ if (Deno.args.includes("--rs")) {
}
if (!didLint) {
- await dlint();
- // todo(dsherret): re-enable
- // await dlintPreferPrimordials();
- console.log("copyright checker");
- await checkCopyright();
- await clippy();
+ await Promise.all([
+ dlint(),
+ // todo(dsherret): re-enable
+ // dlintPreferPrimordials(),
+ checkCopyright(),
+ clippy(),
+ ]);
}
async function dlint() {
const configFile = join(ROOT_PATH, ".dlint.json");
const execPath = getPrebuiltToolPath("dlint");
- console.log("dlint");
const sourceFiles = await getSources(ROOT_PATH, [
"*.js",
@@ -65,19 +65,26 @@ async function dlint() {
}
const chunks = splitToChunks(sourceFiles, `${execPath} run`.length);
+ const pending = [];
for (const chunk of chunks) {
const cmd = new Deno.Command(execPath, {
cwd: ROOT_PATH,
args: ["run", "--config=" + configFile, ...chunk],
- stdout: "inherit",
- stderr: "inherit",
+ // capture to not conflict with clippy output
+ stderr: "piped",
});
- const { code } = await cmd.output();
-
- if (code > 0) {
- throw new Error("dlint failed");
- }
+ pending.push(
+ cmd.output().then(({ stderr, code }) => {
+ if (code > 0) {
+ const decoder = new TextDecoder();
+ console.log("\n------ dlint ------");
+ console.log(decoder.decode(stderr));
+ throw new Error("dlint failed");
+ }
+ }),
+ );
}
+ await Promise.all(pending);
}
// `prefer-primordials` has to apply only to files related to bootstrapping,
@@ -85,8 +92,6 @@ async function dlint() {
// is needed.
async function dlintPreferPrimordials() {
const execPath = getPrebuiltToolPath("dlint");
- console.log("prefer-primordials");
-
const sourceFiles = await getSources(ROOT_PATH, [
"runtime/**/*.js",
"ext/**/*.js",
@@ -132,8 +137,6 @@ function splitToChunks(paths, initCmdLen) {
}
async function clippy() {
- console.log("clippy");
-
const currentBuildMode = buildMode();
const cmd = ["clippy", "--all-targets", "--all-features", "--locked"];