From f89381432c95d9b782b31c6685ddcff3d1f181a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=94=AF=E7=84=B6?= Date: Fri, 19 Jan 2024 15:55:43 +0800 Subject: [PATCH] feat!: Require Node.js ^18.18.0 || ^20.9.0 || >=21.1.0 (#80) * feat!: Require Node.js ^18.18.0 || ^20.9.0 || >=21.1.0 refs: https://github.com/eslint/eslint/issues/17595 * Update ci.yml * chore: rm patch-esmock * docs: update node.js requirement --- .github/workflows/ci.yml | 10 +++++----- README.md | 2 +- package.json | 4 +--- tests/patch-esmock.js | 22 ---------------------- 4 files changed, 7 insertions(+), 31 deletions(-) delete mode 100644 tests/patch-esmock.js diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dfd73797..576c2e26 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,16 +25,16 @@ jobs: strategy: matrix: os: [ubuntu-latest] - node: [21.x, 20.x, 19.x, 18.x, 17.x, 16.x, 14.x, 12.x, "12.22.0"] + node: [21.x, 20.x, 18.x, "18.18.0"] include: - os: windows-latest - node: "16.x" + node: "lts/*" - os: macOS-latest - node: "16.x" + node: "lts/*" runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 with: node-version: ${{ matrix.node }} - name: Install dependencies diff --git a/README.md b/README.md index ca5768f2..9e2e1dd0 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Utility to create ESLint config files ## Usage -Prerequisites: [Node.js](https://nodejs.org/) (`^12.22.0`, `^14.17.0`, or `>=16.0.0`) built with SSL support. (If you are using an official Node.js distribution, SSL is always built in.) +Prerequisites: [Node.js](https://nodejs.org/) (`^18.18.0`, `^20.9.0`, or `>=21.1.0`) built with SSL support. (If you are using an official Node.js distribution, SSL is always built in.) You can use npm/npx(shipped with Node.js). diff --git a/package.json b/package.json index fdccdfae..33b58b29 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,6 @@ }, "scripts": { "lint": "eslint . --report-unused-disable-directives", - "prepare": "node tests/patch-esmock.js", "release:generate:latest": "eslint-generate-release", "release:generate:alpha": "eslint-generate-prerelease alpha", "release:generate:beta": "eslint-generate-prerelease beta", @@ -60,7 +59,6 @@ "eslint-config-eslint": "^9.0.0", "eslint-release": "^3.2.0", "esmock": "^2.5.8", - "esmock_legacy": "npm:esmock@~2.3.8", "espree": "^9.0.0", "globals": "^13.21.0", "lint-staged": "^12.1.2", @@ -71,7 +69,7 @@ "yorkie": "^2.0.0" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, "lint-staged": { "*.js": "eslint --fix" diff --git a/tests/patch-esmock.js b/tests/patch-esmock.js deleted file mode 100644 index c0749c05..00000000 --- a/tests/patch-esmock.js +++ /dev/null @@ -1,22 +0,0 @@ -/** - * @fileoverview Run by npm to replace esmock with a legacy release on older versions of Node.js. - * @author Francesco Trotta - */ - -import { promises as fs } from "fs"; - -// * esmock < 2.4 works only on Node.js < 19. -// * esmock >= 2.4 works only on Node.js >= 18.6. -// If we are running Node.js < 19, replace the esmock dependency with the legacy release. -// 111 is the ABI version number of Node.js 19: https://nodejs.org/en/download/releases -if (process.versions.modules < 111) { - (async () => { - try { - await fs.access("node_modules/esmock_legacy"); - } catch { - return; - } - await fs.rmdir("node_modules/esmock", { recursive: true }); - await fs.rename("node_modules/esmock_legacy", "node_modules/esmock"); - })(); -}