summaryrefslogtreecommitdiff
path: root/tools/lint.js
diff options
context:
space:
mode:
Diffstat (limited to 'tools/lint.js')
-rwxr-xr-xtools/lint.js50
1 files changed, 25 insertions, 25 deletions
diff --git a/tools/lint.js b/tools/lint.js
index c460951f5..caa761896 100755
--- a/tools/lint.js
+++ b/tools/lint.js
@@ -7,6 +7,28 @@ import {
join,
ROOT_PATH,
} from "./util.js";
+import { checkCopyright } from "./copyright_checker.js";
+
+let didLint = false;
+
+if (Deno.args.includes("--js")) {
+ await dlint();
+ await dlintPreferPrimordials();
+ didLint = true;
+}
+
+if (Deno.args.includes("--rs")) {
+ await clippy();
+ didLint = true;
+}
+
+if (!didLint) {
+ await dlint();
+ await dlintPreferPrimordials();
+ console.log("copyright checker");
+ await checkCopyright();
+ await clippy();
+}
async function dlint() {
const configFile = join(ROOT_PATH, ".dlint.json");
@@ -44,6 +66,7 @@ async function dlint() {
const chunks = splitToChunks(sourceFiles, `${execPath} run`.length);
for (const chunk of chunks) {
const cmd = new Deno.Command(execPath, {
+ cwd: ROOT_PATH,
args: ["run", "--config=" + configFile, ...chunk],
stdout: "inherit",
stderr: "inherit",
@@ -77,6 +100,7 @@ async function dlintPreferPrimordials() {
const chunks = splitToChunks(sourceFiles, `${execPath} run`.length);
for (const chunk of chunks) {
const cmd = new Deno.Command(execPath, {
+ cwd: ROOT_PATH,
args: ["run", "--rule", "prefer-primordials", ...chunk],
stdout: "inherit",
stderr: "inherit",
@@ -116,6 +140,7 @@ async function clippy() {
}
const cargoCmd = new Deno.Command("cargo", {
+ cwd: ROOT_PATH,
args: [
...cmd,
"--",
@@ -131,28 +156,3 @@ async function clippy() {
throw new Error("clippy failed");
}
}
-
-async function main() {
- await Deno.chdir(ROOT_PATH);
-
- let didLint = false;
-
- if (Deno.args.includes("--js")) {
- await dlint();
- await dlintPreferPrimordials();
- didLint = true;
- }
-
- if (Deno.args.includes("--rs")) {
- await clippy();
- didLint = true;
- }
-
- if (!didLint) {
- await dlint();
- await dlintPreferPrimordials();
- await clippy();
- }
-}
-
-await main();