From 7e99d88f21f5d3efbfb2415b9154a3ea21ad7997 Mon Sep 17 00:00:00 2001 From: Masafumi Koba <473530+ybiquitous@users.noreply.github.com> Date: Wed, 11 May 2022 00:17:50 +0900 Subject: [PATCH] fix: use `node:` protocol for Node.js core modules (#1261) --- lib/init.js | 6 +++--- lib/logger.js | 2 +- package.json | 5 ++++- test/init.test.js | 6 +++--- test/types.test.ts | 1 - 5 files changed, 11 insertions(+), 9 deletions(-) diff --git a/lib/init.js b/lib/init.js index 05a4e56c..d843894d 100644 --- a/lib/init.js +++ b/lib/init.js @@ -1,6 +1,6 @@ -import { promises as fsPromises, existsSync } from "fs"; -import { join, relative, resolve } from "path"; -import { inspect } from "util"; +import { promises as fsPromises, existsSync } from "node:fs"; +import { join, relative, resolve } from "node:path"; +import { inspect } from "node:util"; import { defaultLogger } from "./logger.js"; const { copyFile, mkdir, readFile, writeFile, unlink } = fsPromises; diff --git a/lib/logger.js b/lib/logger.js index bc04ee7b..4fc8fb65 100644 --- a/lib/logger.js +++ b/lib/logger.js @@ -1,4 +1,4 @@ -import { EOL } from "os"; +import { EOL } from "node:os"; /** @type {import("../types/ybiq").Logger} */ export const defaultLogger = (msg) => { diff --git a/package.json b/package.json index 868a762c..83083a6f 100644 --- a/package.json +++ b/package.json @@ -151,7 +151,9 @@ "rules": { "import/extensions": "off", "import/no-internal-modules": "off", - "import/prefer-default-export": "off" + "import/no-unresolved": "off", + "import/prefer-default-export": "off", + "node/no-missing-import": "off" }, "overrides": [ { @@ -165,6 +167,7 @@ }, "rules": { "import/no-internal-modules": "off", + "import/no-unresolved": "off", "node/no-unsupported-features/es-syntax": "off" } }, diff --git a/test/init.test.js b/test/init.test.js index bf9a011e..8eacb4aa 100644 --- a/test/init.test.js +++ b/test/init.test.js @@ -1,6 +1,6 @@ -import { copyFileSync, existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "fs"; -import { tmpdir } from "os"; -import { join, resolve } from "path"; +import { copyFileSync, existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs"; +import { tmpdir } from "node:os"; +import { join, resolve } from "node:path"; import { init } from "../lib/init.js"; import { exec } from "./helpers/exec.js"; import { pkg } from "./helpers/pkg.js"; diff --git a/test/types.test.ts b/test/types.test.ts index 2d14ac8a..3a8e41e3 100644 --- a/test/types.test.ts +++ b/test/types.test.ts @@ -1,4 +1,3 @@ -// eslint-disable-next-line import/no-unresolved, node/no-missing-import -- Prevent error: TS7016: Could not find a declaration file for module '../lib/index.js' import * as ybiq from ".."; const noop = (arg?: unknown): void => {