From dd42b8b7ff631e2b4f37aae55ea2d578e8ea21e5 Mon Sep 17 00:00:00 2001 From: gap579137 <30596626+gap579137@users.noreply.github.com> Date: Fri, 20 Sep 2024 10:06:27 -0500 Subject: [PATCH] Update lint.js --- scripts/lint.js | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/scripts/lint.js b/scripts/lint.js index dec44db0..27ba700d 100644 --- a/scripts/lint.js +++ b/scripts/lint.js @@ -1,23 +1,25 @@ -const fs = require("fs").promises; -const path = require("path"); +const fs = require("node:fs").promises; +const path = require("node:path"); (async () => { - let hasError = false; + const hasError = false; try { const directoryPath = path.join(__dirname, ".."); - const files = (await fs.readdir(directoryPath)).filter(file => file.endsWith(".txt") && file !== "everything.txt"); + const files = (await fs.readdir(directoryPath)).filter( + (file) => file.endsWith(".txt") && file !== "everything.txt", + ); - await Promise.all(files.map(async file => { - const filePath = path.join(directoryPath, file); - const fileContents = await fs.readFile(filePath, "utf8"); + await Promise.all( + files.map(async (file) => { + const filePath = path.join(directoryPath, file); + const fileContents = await fs.readFile(filePath, "utf8"); + const lines = fileContents.split("\n"); + const commentedURLs = lines + .filter((line) => line.startsWith("# 0.0.0.0")) + .map((line) => line.split(" ")[2].trim()); - const lines = fileContents.split("\n"); - const commentedURLs = lines - .filter(line => line.startsWith("# 0.0.0.0")) - .map(line => line.split(" ")[2].trim()); - - let isHeaderComplete = false; + let isHeaderComplete = false; lines.forEach((line, index) => { // Mark the end of the header section @@ -78,6 +80,7 @@ const path = require("path"); }); })); + process.exit(hasError ? 1 : 0); } catch (error) { console.error("An error occurred during file processing:", error);