From 3b7c0af9474fbbfb39b142a5e95d5df04e09610f Mon Sep 17 00:00:00 2001 From: Milos Djermanovic Date: Mon, 10 Jun 2024 13:59:45 +0200 Subject: [PATCH] refactor: switch to eslint-config-eslint v11 (#127) --- bin/create-config.js | 2 +- eslint.config.js | 4 +++- lib/config-generator.js | 8 ++++---- lib/utils/npm-utils.js | 4 ++-- package.json | 4 ++-- tests/_utils/in-memory-fs.js | 2 +- tests/config-snapshots.spec.js | 2 +- tests/utils/npm-utils.spec.js | 2 +- 8 files changed, 15 insertions(+), 13 deletions(-) diff --git a/bin/create-config.js b/bin/create-config.js index 6623c258..be708266 100755 --- a/bin/create-config.js +++ b/bin/create-config.js @@ -7,7 +7,7 @@ import { ConfigGenerator } from "../lib/config-generator.js"; import { findPackageJson } from "../lib/utils/npm-utils.js"; -import process from "process"; +import process from "node:process"; const cwd = process.cwd(); diff --git a/eslint.config.js b/eslint.config.js index b1544b43..2a3f066b 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -1,4 +1,5 @@ import eslintConfigESLint from "eslint-config-eslint"; +import eslintConfigESLintFormatting from "eslint-config-eslint/formatting"; export default [ { @@ -7,5 +8,6 @@ export default [ "tests/fixtures/" ] }, - ...eslintConfigESLint + ...eslintConfigESLint, + eslintConfigESLintFormatting ]; diff --git a/lib/config-generator.js b/lib/config-generator.js index 3e364fae..2d3d55f5 100644 --- a/lib/config-generator.js +++ b/lib/config-generator.js @@ -2,10 +2,10 @@ * @fileoverview to generate config files. * @author 唯然 */ -import process from "process"; -import path from "path"; -import { spawnSync } from "child_process"; -import { writeFile } from "fs/promises"; +import process from "node:process"; +import path from "node:path"; +import { spawnSync } from "node:child_process"; +import { writeFile } from "node:fs/promises"; import enquirer from "enquirer"; import { isPackageTypeModule, installSyncSaveDev, fetchPeerDependencies, findPackageJson } from "./utils/npm-utils.js"; import { getShorthandName } from "./utils/naming.js"; diff --git a/lib/utils/npm-utils.js b/lib/utils/npm-utils.js index 84736cd4..dff60504 100644 --- a/lib/utils/npm-utils.js +++ b/lib/utils/npm-utils.js @@ -8,10 +8,10 @@ // Requirements //------------------------------------------------------------------------------ -import fs from "fs"; +import fs from "node:fs"; import spawn from "cross-spawn"; -import path from "path"; +import path from "node:path"; import * as log from "./logging.js"; //------------------------------------------------------------------------------ diff --git a/package.json b/package.json index 967ca032..edaca221 100644 --- a/package.json +++ b/package.json @@ -45,8 +45,8 @@ }, "devDependencies": { "@vitest/coverage-v8": "^1.3.1", - "eslint": "^9.1.1", - "eslint-config-eslint": "^10.0.0", + "eslint": "^9.4.0", + "eslint-config-eslint": "^11.0.0", "eslint-release": "^3.2.0", "lint-staged": "^12.1.2", "memfs": "^3.4.0", diff --git a/tests/_utils/in-memory-fs.js b/tests/_utils/in-memory-fs.js index 4c64ae40..db041415 100644 --- a/tests/_utils/in-memory-fs.js +++ b/tests/_utils/in-memory-fs.js @@ -8,7 +8,7 @@ // Requirements //----------------------------------------------------------------------------- -import path from "path"; +import path from "node:path"; import memfs from "memfs"; const { Volume, createFsFromVolume } = memfs; diff --git a/tests/config-snapshots.spec.js b/tests/config-snapshots.spec.js index 4ad5f440..e6195321 100644 --- a/tests/config-snapshots.spec.js +++ b/tests/config-snapshots.spec.js @@ -9,7 +9,7 @@ import { ConfigGenerator } from "../lib/config-generator.js"; import { expect, describe, test } from "vitest"; import { fileURLToPath } from "node:url"; -import { join } from "path"; +import { join } from "node:path"; const __filename = fileURLToPath(import.meta.url); // eslint-disable-line no-underscore-dangle -- commonjs convention diff --git a/tests/utils/npm-utils.spec.js b/tests/utils/npm-utils.spec.js index 80daf728..8b318960 100644 --- a/tests/utils/npm-utils.spec.js +++ b/tests/utils/npm-utils.spec.js @@ -18,7 +18,7 @@ import { } from "../../lib/utils/npm-utils.js"; import { defineInMemoryFs } from "../_utils/in-memory-fs.js"; import { assert, describe, afterEach, it } from "vitest"; -import fs from "fs"; +import fs from "node:fs"; //------------------------------------------------------------------------------ // Helpers