From 5f02aa61705f31b649ddde3fd9c2cc21dfc8d033 Mon Sep 17 00:00:00 2001 From: Santeri Hiltunen Date: Sun, 23 Nov 2025 21:28:37 +0200 Subject: [PATCH] Use native dirname instead of custom one --- src/main.mjs | 6 ++---- template/eslint.config.mjs | 6 +----- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/src/main.mjs b/src/main.mjs index 02865e4..4ace061 100644 --- a/src/main.mjs +++ b/src/main.mjs @@ -7,7 +7,6 @@ import { writeFile, } from "node:fs/promises"; import { join as pathJoin } from "node:path"; -import { fileURLToPath } from "node:url"; import { EOL } from "node:os"; import { debug, @@ -18,10 +17,9 @@ import { } from "./util.mjs"; import { styleText } from "node:util"; -const __dirname = fileURLToPath(new URL(".", import.meta.url)); -const templatePath = pathJoin(__dirname, "..", "template"); +const templatePath = pathJoin(import.meta.dirname, "..", "template"); -debug("__dirname", __dirname); +debug("dirname", import.meta.dirname); debug("templatePath", templatePath); const lineEndRegex = /\r\n|\r|\n/g; diff --git a/template/eslint.config.mjs b/template/eslint.config.mjs index d349d49..0b2511b 100644 --- a/template/eslint.config.mjs +++ b/template/eslint.config.mjs @@ -3,10 +3,6 @@ import tsEslint from "typescript-eslint"; import prettier from "eslint-config-prettier/flat"; import nodePlugin from "eslint-plugin-n"; import globals from "globals"; -import { dirname } from "node:path"; -import { fileURLToPath } from "node:url"; - -const __dirname = dirname(fileURLToPath(import.meta.url)); export default tsEslint.config( // https://eslint.org/docs/latest/use/configure/ignore @@ -28,7 +24,7 @@ export default tsEslint.config( languageOptions: { parserOptions: { projectService: true, - tsconfigRootDir: __dirname, + tsconfigRootDir: import.meta.dirname, }, globals: { ...globals.nodeBuiltin,