From c56e52d96b015438055dfadc619d4909ea30d41b Mon Sep 17 00:00:00 2001 From: Pierre Demailly Date: Fri, 20 Mar 2026 00:37:19 +0100 Subject: [PATCH] chore: update @openally/config.eslint --- bin/index.js | 6 +----- esbuild.config.js | 9 +++------ package.json | 2 +- test/commands/cache.test.js | 6 +----- test/commands/extract-integrity.test.js | 4 +--- test/commands/scorecard.test.js | 4 +--- test/commands/summary.test.js | 8 +++----- test/commands/verify.test.js | 4 +--- test/process/extract-integrity/invalid-spec.js | 6 +----- test/process/extract-integrity/missing-version.js | 6 +----- test/process/extract-integrity/not-found.js | 6 +----- test/process/extract-integrity/valid-spec.js | 6 +----- test/process/summary-zero-dependencies.js | 6 +----- test/process/summary.js | 6 +----- workspaces/documentation-ui/esbuild.config.js | 9 +++------ workspaces/documentation-ui/src/nodejs/esm.js | 6 +----- workspaces/server/test/httpServer.test.ts | 12 ++++-------- workspaces/vis-network/esbuild.config.js | 7 ++----- workspaces/vis-network/test/dataset.fixture.js | 6 +----- 19 files changed, 29 insertions(+), 90 deletions(-) diff --git a/bin/index.js b/bin/index.js index 13e372d4..2d1aab09 100755 --- a/bin/index.js +++ b/bin/index.js @@ -11,7 +11,6 @@ catch { // Import Node.js Dependencies import { createRequire } from "node:module"; import path from "node:path"; -import { fileURLToPath } from "node:url"; // Import Third-party Dependencies import * as i18n from "@nodesecure/i18n"; @@ -24,16 +23,13 @@ import semver from "semver"; import * as commands from "../src/commands/index.js"; import kleur from "../src/utils/styleText.js"; -// CONSTANTS -const __dirname = path.dirname(fileURLToPath(import.meta.url)); - // TODO: replace with await import() when available const require = createRequire(import.meta.url); const manifest = require("../package.json"); await i18n.getLocalLang(); await i18n.extendFromSystemPath( - path.join(__dirname, "..", "i18n") + path.join(import.meta.dirname, "..", "i18n") ); console.log(kleur.grey().bold(`\n > ${i18n.getTokenSync("cli.executing_at")}: ${kleur.yellow().bold(process.cwd())}\n`)); diff --git a/esbuild.config.js b/esbuild.config.js index 3a3ecd20..7a244a62 100644 --- a/esbuild.config.js +++ b/esbuild.config.js @@ -1,19 +1,16 @@ // Import Node.js Dependencies import path from "node:path"; import fs from "node:fs/promises"; -import { fileURLToPath } from "node:url"; // Import Third-party Dependencies import esbuild from "esbuild"; import { getBuildConfiguration } from "@nodesecure/documentation-ui/node"; // CONSTANTS -const __dirname = path.dirname(fileURLToPath(import.meta.url)); - -const kPublicDir = path.join(__dirname, "public"); -const kOutDir = path.join(__dirname, "dist"); +const kPublicDir = path.join(import.meta.dirname, "public"); +const kOutDir = path.join(import.meta.dirname, "dist"); const kImagesDir = path.join(kPublicDir, "img"); -const kNodeModulesDir = path.join(__dirname, "node_modules"); +const kNodeModulesDir = path.join(import.meta.dirname, "node_modules"); await esbuild.build({ entryPoints: [ diff --git a/package.json b/package.json index 2c4f14e9..83b0b356 100644 --- a/package.json +++ b/package.json @@ -71,7 +71,7 @@ "devDependencies": { "@nodesecure/size-satisfies": "^1.1.0", "@nodesecure/vis-network": "^1.4.0", - "@openally/config.eslint": "^2.1.0", + "@openally/config.eslint": "^2.4.2", "@openally/config.typescript": "1.2.1", "@openally/httpie": "^1.0.0", "@types/node": "^25.0.3", diff --git a/test/commands/cache.test.js b/test/commands/cache.test.js index c0c3f2d7..567bbba8 100644 --- a/test/commands/cache.test.js +++ b/test/commands/cache.test.js @@ -12,7 +12,6 @@ import childProcess from "node:child_process"; import fs from "node:fs"; import path from "node:path"; import { after, before, describe, it } from "node:test"; -import url from "node:url"; // Import Third-party Dependencies import { DEFAULT_PAYLOAD_PATH } from "@nodesecure/cache"; @@ -23,9 +22,6 @@ import { cache } from "@nodesecure/server"; import { main } from "../../src/commands/cache.js"; import { arrayFromAsync } from "../helpers/utils.js"; -// CONSTANTS -const __dirname = path.dirname(url.fileURLToPath(import.meta.url)); - describe("CLI Commands: cache", { concurrency: 1 }, () => { let lang; let actualCache; @@ -51,7 +47,7 @@ describe("CLI Commands: cache", { concurrency: 1 }, () => { } await i18n.setLocalLang("english"); await i18n.extendFromSystemPath( - path.join(__dirname, "..", "..", "i18n") + path.join(import.meta.dirname, "..", "..", "i18n") ); lang = await i18n.getLocalLang(); diff --git a/test/commands/extract-integrity.test.js b/test/commands/extract-integrity.test.js index 2daef3e2..f7d60dcf 100644 --- a/test/commands/extract-integrity.test.js +++ b/test/commands/extract-integrity.test.js @@ -10,15 +10,13 @@ catch { import assert from "node:assert"; import path from "node:path"; import { describe, test } from "node:test"; -import { fileURLToPath } from "node:url"; // Import Internal Dependencies import { runProcess } from "../helpers/cliCommandRunner.js"; import { arrayFromAsync } from "../helpers/utils.js"; // CONSTANTS -const __dirname = path.dirname(fileURLToPath(import.meta.url)); -const kProcessDir = path.join(__dirname, "..", "process"); +const kProcessDir = path.join(import.meta.dirname, "..", "process"); describe("CLI Commands: extract integrity", () => { test("should not find an integrity diff", async() => { diff --git a/test/commands/scorecard.test.js b/test/commands/scorecard.test.js index d2ea94e9..ef6deeb6 100644 --- a/test/commands/scorecard.test.js +++ b/test/commands/scorecard.test.js @@ -3,7 +3,6 @@ import assert from "node:assert"; import fs from "node:fs"; import path from "node:path"; import { describe, test } from "node:test"; -import { fileURLToPath } from "node:url"; // Import Third-party Dependencies import { API_URL } from "@nodesecure/ossf-scorecard-sdk"; @@ -15,8 +14,7 @@ import { runProcess } from "../helpers/cliCommandRunner.js"; import { arrayFromAsync, getExpectedScorecardLines } from "../helpers/utils.js"; // CONSTANTS -const __dirname = path.dirname(fileURLToPath(import.meta.url)); -const kProcessDir = path.join(__dirname, "..", "process"); +const kProcessDir = path.join(import.meta.dirname, "..", "process"); const kProcessPath = path.join(kProcessDir, "scorecard.js"); describe("CLI Commands: scorecard", () => { diff --git a/test/commands/summary.test.js b/test/commands/summary.test.js index 150e92d6..9909676a 100644 --- a/test/commands/summary.test.js +++ b/test/commands/summary.test.js @@ -7,7 +7,6 @@ catch { } // Import Node.js Dependencies -import { fileURLToPath } from "node:url"; import path from "node:path"; import { describe, it } from "node:test"; import { stripVTControlCharacters } from "node:util"; @@ -19,8 +18,7 @@ import * as i18n from "@nodesecure/i18n"; import { runProcess } from "../helpers/cliCommandRunner.js"; // CONSTANTS -const __dirname = path.dirname(fileURLToPath(import.meta.url)); -const kProcessDir = path.join(__dirname, "..", "process"); +const kProcessDir = path.join(import.meta.dirname, "..", "process"); const kProcessPath = path.join(kProcessDir, "summary.js"); describe("CLI Commands: summary", () => { @@ -46,7 +44,7 @@ describe("CLI Commands: summary", () => { const processOptions = { path: kProcessPath, - cwd: path.join(__dirname, "..", "fixtures") + cwd: path.join(import.meta.dirname, "..", "fixtures") }; for await (const line of runProcess(processOptions)) { @@ -66,7 +64,7 @@ describe("CLI Commands: summary", () => { t.plan(expectedLines.length * 2); const processOptions = { path: kProcessPath.replace("summary.js", "summary-zero-dependencies.js"), - cwd: path.join(__dirname, "..", "fixtures") + cwd: path.join(import.meta.dirname, "..", "fixtures") }; for await (const line of runProcess(processOptions)) { diff --git a/test/commands/verify.test.js b/test/commands/verify.test.js index 8eaadaa0..ae6c1895 100644 --- a/test/commands/verify.test.js +++ b/test/commands/verify.test.js @@ -10,15 +10,13 @@ catch { import assert from "node:assert"; import path from "node:path"; import { describe, test } from "node:test"; -import { fileURLToPath } from "node:url"; // Import Internal Dependencies import { VERIFY_EXPECTED_LINES } from "../fixtures/verifyExpectedStdout.js"; import { runProcess } from "../helpers/cliCommandRunner.js"; // CONSTANTS -const __dirname = path.dirname(fileURLToPath(import.meta.url)); -const kProcessDir = path.join(__dirname, "..", "process"); +const kProcessDir = path.join(import.meta.dirname, "..", "process"); const kExpectVerifyJson = `{ "foo": "bar" }`.split("\n"); diff --git a/test/process/extract-integrity/invalid-spec.js b/test/process/extract-integrity/invalid-spec.js index 05e07ce4..5837afcf 100644 --- a/test/process/extract-integrity/invalid-spec.js +++ b/test/process/extract-integrity/invalid-spec.js @@ -1,6 +1,5 @@ // Import Node.js Dependencies import path from "node:path"; -import { fileURLToPath } from "node:url"; // Import Third-party Dependencies import * as i18n from "@nodesecure/i18n"; @@ -9,12 +8,9 @@ import * as i18n from "@nodesecure/i18n"; import * as extractIntegrity from "../../../src/commands/extract-integrity.js"; import { prepareProcess } from "../../helpers/cliCommandRunner.js"; -// CONSTANTS -const __dirname = path.dirname(fileURLToPath(import.meta.url)); - await i18n.getLocalLang(); await i18n.extendFromSystemPath( - path.join(__dirname, "..", "..", "..", "i18n") + path.join(import.meta.dirname, "..", "..", "..", "i18n") ); prepareProcess(extractIntegrity.main, [""]); diff --git a/test/process/extract-integrity/missing-version.js b/test/process/extract-integrity/missing-version.js index 64691c25..40a32fb7 100644 --- a/test/process/extract-integrity/missing-version.js +++ b/test/process/extract-integrity/missing-version.js @@ -1,6 +1,5 @@ // Import Node.js Dependencies import path from "node:path"; -import { fileURLToPath } from "node:url"; // Import Third-party Dependencies import * as i18n from "@nodesecure/i18n"; @@ -9,12 +8,9 @@ import * as i18n from "@nodesecure/i18n"; import * as extractIntegrity from "../../../src/commands/extract-integrity.js"; import { prepareProcess } from "../../helpers/cliCommandRunner.js"; -// CONSTANTS -const __dirname = path.dirname(fileURLToPath(import.meta.url)); - await i18n.getLocalLang(); await i18n.extendFromSystemPath( - path.join(__dirname, "..", "..", "..", "i18n") + path.join(import.meta.dirname, "..", "..", "..", "i18n") ); prepareProcess(extractIntegrity.main, ["express"]); diff --git a/test/process/extract-integrity/not-found.js b/test/process/extract-integrity/not-found.js index d74a6f97..cccc3a99 100644 --- a/test/process/extract-integrity/not-found.js +++ b/test/process/extract-integrity/not-found.js @@ -1,6 +1,5 @@ // Import Node.js Dependencies import path from "node:path"; -import { fileURLToPath } from "node:url"; // Import Third-party Dependencies import * as i18n from "@nodesecure/i18n"; @@ -9,12 +8,9 @@ import * as i18n from "@nodesecure/i18n"; import * as extractIntegrity from "../../../src/commands/extract-integrity.js"; import { prepareProcess } from "../../helpers/cliCommandRunner.js"; -// CONSTANTS -const __dirname = path.dirname(fileURLToPath(import.meta.url)); - await i18n.getLocalLang(); await i18n.extendFromSystemPath( - path.join(__dirname, "..", "..", "..", "i18n") + path.join(import.meta.dirname, "..", "..", "..", "i18n") ); prepareProcess(extractIntegrity.main, ["express@not-found"]); diff --git a/test/process/extract-integrity/valid-spec.js b/test/process/extract-integrity/valid-spec.js index 0a3bb1d7..b3fd7d47 100644 --- a/test/process/extract-integrity/valid-spec.js +++ b/test/process/extract-integrity/valid-spec.js @@ -1,6 +1,5 @@ // Import Node.js Dependencies import path from "node:path"; -import { fileURLToPath } from "node:url"; // Import Third-party Dependencies import * as i18n from "@nodesecure/i18n"; @@ -9,12 +8,9 @@ import * as i18n from "@nodesecure/i18n"; import * as extractIntegrity from "../../../src/commands/extract-integrity.js"; import { prepareProcess } from "../../helpers/cliCommandRunner.js"; -// CONSTANTS -const __dirname = path.dirname(fileURLToPath(import.meta.url)); - await i18n.getLocalLang(); await i18n.extendFromSystemPath( - path.join(__dirname, "..", "..", "..", "i18n") + path.join(import.meta.dirname, "..", "..", "..", "i18n") ); prepareProcess(extractIntegrity.main, ["express@4.17.1"]); diff --git a/test/process/summary-zero-dependencies.js b/test/process/summary-zero-dependencies.js index c4d50102..5d44722b 100644 --- a/test/process/summary-zero-dependencies.js +++ b/test/process/summary-zero-dependencies.js @@ -1,6 +1,5 @@ // Import Node.js Dependencies import path from "node:path"; -import url from "node:url"; // Import Third-party Dependencies import * as i18n from "@nodesecure/i18n"; @@ -9,12 +8,9 @@ import * as i18n from "@nodesecure/i18n"; import * as summary from "../../src/commands/summary.js"; import { prepareProcess } from "../helpers/cliCommandRunner.js"; -// CONSTANTS -const __dirname = path.dirname(url.fileURLToPath(import.meta.url)); - await i18n.getLocalLang(); await i18n.extendFromSystemPath( - path.join(__dirname, "..", "..", "i18n") + path.join(import.meta.dirname, "..", "..", "i18n") ); prepareProcess(summary.main, ["result-test2.json"]); diff --git a/test/process/summary.js b/test/process/summary.js index 8873353a..32ffbb84 100644 --- a/test/process/summary.js +++ b/test/process/summary.js @@ -1,6 +1,5 @@ // Import Node.js Dependencies import path from "node:path"; -import url from "node:url"; // Import Third-party Dependencies import * as i18n from "@nodesecure/i18n"; @@ -9,12 +8,9 @@ import * as i18n from "@nodesecure/i18n"; import * as summary from "../../src/commands/summary.js"; import { prepareProcess } from "../helpers/cliCommandRunner.js"; -// CONSTANTS -const __dirname = path.dirname(url.fileURLToPath(import.meta.url)); - await i18n.getLocalLang(); await i18n.extendFromSystemPath( - path.join(__dirname, "..", "..", "i18n") + path.join(import.meta.dirname, "..", "..", "i18n") ); prepareProcess(summary.main, ["result-test1.json"]); diff --git a/workspaces/documentation-ui/esbuild.config.js b/workspaces/documentation-ui/esbuild.config.js index 720526d2..a9c1dc7d 100644 --- a/workspaces/documentation-ui/esbuild.config.js +++ b/workspaces/documentation-ui/esbuild.config.js @@ -1,21 +1,18 @@ // Import Node.js Dependencies import path from "node:path"; import fs from "node:fs"; -import { fileURLToPath } from "node:url"; // Import Third-party Dependencies import esbuild from "esbuild"; // CONSTANTS -const __dirname = path.dirname(fileURLToPath(import.meta.url)); - -const kMainDir = path.join(__dirname, "example"); -const kOutDir = path.join(__dirname, "dist"); +const kMainDir = path.join(import.meta.dirname, "example"); +const kOutDir = path.join(import.meta.dirname, "dist"); await esbuild.build({ entryPoints: [ path.join(kMainDir, "master.js"), - path.join(__dirname, "src", "css", "main.css") + path.join(import.meta.dirname, "src", "css", "main.css") ], platform: "browser", bundle: true, diff --git a/workspaces/documentation-ui/src/nodejs/esm.js b/workspaces/documentation-ui/src/nodejs/esm.js index 91c7b041..e56dceb1 100644 --- a/workspaces/documentation-ui/src/nodejs/esm.js +++ b/workspaces/documentation-ui/src/nodejs/esm.js @@ -1,14 +1,10 @@ // Import Node.js Dependencies -import { fileURLToPath } from "node:url"; import path from "node:path"; -// CONSTANTS -const __dirname = path.dirname(fileURLToPath(import.meta.url)); - export function getBuildConfiguration() { return { entryPoints: [ - path.join(__dirname, "..", "css", "main.css") + path.join(import.meta.dirname, "..", "css", "main.css") ] }; } diff --git a/workspaces/server/test/httpServer.test.ts b/workspaces/server/test/httpServer.test.ts index abcffa46..70823bb6 100644 --- a/workspaces/server/test/httpServer.test.ts +++ b/workspaces/server/test/httpServer.test.ts @@ -1,5 +1,4 @@ // Import Node.js Dependencies -import { fileURLToPath } from "node:url"; import { after, before, describe, test } from "node:test"; import { once } from "node:events"; import type { Server } from "node:http"; @@ -21,10 +20,7 @@ import * as flagsEndpoint from "../src/endpoints/flags.ts"; // CONSTANTS const kHttpPort = 17049; const kHttpURL = new URL(`http://localhost:${kHttpPort}`); -const __dirname = path.dirname(fileURLToPath(import.meta.url)); - -const JSON_PATH = path.join(__dirname, "fixtures", "httpServer.json"); - +const kJsonPath = path.join(import.meta.dirname, "fixtures", "httpServer.json"); const kGlobalDispatcher = getGlobalDispatcher(); const kMockAgent = new MockAgent(); const kBundlephobiaPool = kMockAgent.get("https://bundlephobia.com"); @@ -37,10 +33,10 @@ describe("httpServer", { concurrency: 1 }, () => { before(async() => { setGlobalDispatcher(kMockAgent); await i18n.extendFromSystemPath( - path.join(__dirname, "..", "..", "..", "i18n") + path.join(import.meta.dirname, "..", "..", "..", "i18n") ); - httpServer = buildServer(JSON_PATH, { + httpServer = buildServer(kJsonPath, { projectRootDir: kProjectRootDir, componentsDir: kComponentsDir, i18n: { @@ -314,7 +310,7 @@ describe("httpServer without options", () => { let httpServer: Server; before(async() => { - httpServer = buildServer(JSON_PATH, { + httpServer = buildServer(kJsonPath, { projectRootDir: kProjectRootDir, componentsDir: kComponentsDir, i18n: { diff --git a/workspaces/vis-network/esbuild.config.js b/workspaces/vis-network/esbuild.config.js index 49dbc91f..3ae80ea2 100644 --- a/workspaces/vis-network/esbuild.config.js +++ b/workspaces/vis-network/esbuild.config.js @@ -1,17 +1,14 @@ // Import Node.js Dependencies import path from "node:path"; import fs from "node:fs"; -import { fileURLToPath } from "node:url"; // Import Third-party Dependencies import esbuild from "esbuild"; import { getManifest } from "@nodesecure/flags"; // CONSTANTS -const __dirname = path.dirname(fileURLToPath(import.meta.url)); - -const kMainDir = path.join(__dirname, "example"); -const kOutDir = path.join(__dirname, "dist"); +const kMainDir = path.join(import.meta.dirname, "example"); +const kOutDir = path.join(import.meta.dirname, "dist"); await esbuild.build({ entryPoints: [ diff --git a/workspaces/vis-network/test/dataset.fixture.js b/workspaces/vis-network/test/dataset.fixture.js index 622b1c35..5b977314 100644 --- a/workspaces/vis-network/test/dataset.fixture.js +++ b/workspaces/vis-network/test/dataset.fixture.js @@ -1,12 +1,8 @@ // Import Node.js Dependencies import fsPromises from "node:fs/promises"; import path from "node:path"; -import { fileURLToPath } from "node:url"; -const __filename = fileURLToPath(import.meta.url); -const __dirname = path.dirname(__filename); - -const filePath = path.resolve(__dirname, "./dataset-payload.json"); +const filePath = path.resolve(import.meta.dirname, "./dataset-payload.json"); export async function getDataSetPayload() { const dataSetPayloadStr = await fsPromises.readFile(filePath);