summaryrefslogtreecommitdiff
path: root/tools/lint.js
diff options
context:
space:
mode:
authorDavid Sherret <dsherret@users.noreply.github.com>2023-01-13 13:42:15 -0500
committerGitHub <noreply@github.com>2023-01-13 13:42:15 -0500
commit3d423e114e46f206ad2c6bfa5dfcb22094c5d2f6 (patch)
tree2bc1e25c9703128cd0b0ceccea63f659750226f2 /tools/lint.js
parent377f59327344bbb4f37b2eec189ae981a9a9db45 (diff)
chore: small cleanup of scripts in ./tools and run copyright checker in lint.js (#17393)
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();