diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index f430cbd8..4456b28d 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -13,13 +13,11 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v1 - with: - fetch-depth: 1 + uses: actions/checkout@v2 - name: Install Node.js - uses: actions/setup-node@v1 + uses: actions/setup-node@v2 with: - node: 12.x + node-version: 16 - name: Install Packages run: npm install - name: Lint @@ -27,86 +25,38 @@ jobs: test: name: Test - strategy: matrix: - os: [ubuntu-latest, windows-latest, macOS-latest] - eslint: [6.x, 5.x] - node: [13.x, 12.x, 10.x, 8.x] - exclude: - # On Windows, run tests with only the latest LTS environments. - - os: windows-latest - eslint: 6.x - node: 13.x - - os: windows-latest - eslint: 6.x - node: 10.x - - os: windows-latest - eslint: 6.x - node: 8.x + os: [ubuntu-latest] + eslint: [6] + node: [10, 12, 14, 16] + include: + # On other platforms - os: windows-latest - eslint: 5.x - node: 13.x - - os: windows-latest - eslint: 5.x - node: 12.x - - os: windows-latest - eslint: 5.x - node: 10.x - - os: windows-latest - eslint: 5.x - node: 8.x - # On macOS, run tests with only the latest LTS environments. - - os: macOS-latest - eslint: 6.x - node: 13.x - - os: macOS-latest - eslint: 6.x - node: 10.x - - os: macOS-latest - eslint: 6.x - node: 8.x - - os: macOS-latest - eslint: 5.x - node: 13.x - - os: macOS-latest - eslint: 5.x - node: 12.x - - os: macOS-latest - eslint: 5.x - node: 10.x - - os: macOS-latest - eslint: 5.x - node: 8.x - # Run ESLint 5.x tests on only the latest LTS Node. - - os: ubuntu-latest - eslint: 5.x - node: 13.x - - os: ubuntu-latest - eslint: 5.x - node: 10.x - - os: ubuntu-latest - eslint: 5.x - node: 8.x + node: 16 + - os: macos-latest + node: 16 + # On old ESLint versions + - eslint: 5 + node: 16 + # On the minimum supported ESLint/Node.js version + - eslint: 5.16.0 + node: 10.0.0 runs-on: ${{ matrix.os }} steps: - name: Checkout - uses: actions/checkout@v1 - with: - fetch-depth: 1 + uses: actions/checkout@v2 - name: Install Node.js ${{ matrix.node }} - uses: actions/setup-node@v1 + uses: actions/setup-node@v2 with: node-version: ${{ matrix.node }} - name: Install Packages run: npm install - - name: Install ESLint ${{ matrix.eslint }} - # We need to execute this command twice because of npm's bug. - # See also: https://npm.community/t/error-node-modules-staging-eslint-e7cf6846-node-modules-eslint - run: | - npm install --no-save eslint@${{ matrix.eslint }} - npm install --no-save eslint@${{ matrix.eslint }} + env: + CI: true + - name: Install ESLint@${{ matrix.eslint }} + run: npm install eslint@${{ matrix.eslint }} - name: Test run: npm run -s test:ci - name: Send Coverage diff --git a/README.md b/README.md index f8525b8b..2f31e2dd 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ Additional ESLint's rules for Node.js $ npm install --save-dev eslint eslint-plugin-node ``` -- Requires Node.js `>=8.10.0` +- Requires Node.js `^10.0.0 || ^12.0.0 || >=14.0.0` - Requires ESLint `>=5.16.0` **Note:** It recommends a use of [the "engines" field of package.json](https://docs.npmjs.com/files/package.json#engines). The "engines" field is used by `node/no-unsupported-features/*` rules. @@ -53,7 +53,7 @@ $ npm install --save-dev eslint eslint-plugin-node "version": "1.0.0", "type": "commonjs", "engines": { - "node": ">=8.10.0" + "node": ">=10.0.0" } } ``` diff --git a/docs/rules/no-deprecated-api.md b/docs/rules/no-deprecated-api.md index 01a58883..6d3bdccc 100644 --- a/docs/rules/no-deprecated-api.md +++ b/docs/rules/no-deprecated-api.md @@ -149,12 +149,12 @@ For example of `package.json`: "name": "your-module", "version": "1.0.0", "engines": { - "node": ">=8.0.0" + "node": ">=10.0.0" } } ``` -If you omit the [engines] field, this rule chooses `>=8.0.0` as the configured Node.js version since `8` is the minimum version the community is maintaining (see also [Node.js Release Working Group](https://github.com/nodejs/Release#readme)). +If you omit the [engines] field, this rule chooses `>=10.0.0` as the configured Node.js version since `10` is the minimum version the community is maintaining (see also [Node.js Release Working Group](https://github.com/nodejs/Release#readme)). ### Options @@ -164,7 +164,7 @@ This rule has 3 options. { "rules": { "node/no-deprecated-api": ["error", { - "version": ">=8.0.0", + "version": ">=10.0.0", "ignoreModuleItems": [], "ignoreGlobalItems": [] }] diff --git a/docs/rules/no-unsupported-features.md b/docs/rules/no-unsupported-features.md index cbcdd651..18b6d007 100644 --- a/docs/rules/no-unsupported-features.md +++ b/docs/rules/no-unsupported-features.md @@ -31,12 +31,12 @@ For example of `package.json`: "name": "your-module", "version": "1.0.0", "engines": { - "node": ">=6.0.0" + "node": ">=10.0.0" } } ``` -If the [engines] field is omitted, this rule chooses `4` since it's the minimum version the community is maintaining. +If you omit the [engines] field, this rule chooses `>=10.0.0` as the configured Node.js version since `10` is the minimum version the community is maintaining (see also [Node.js Release Working Group](https://github.com/nodejs/Release#readme)). Examples of :-1: **incorrect** code for this rule: diff --git a/docs/rules/no-unsupported-features/es-builtins.md b/docs/rules/no-unsupported-features/es-builtins.md index 7bc561eb..b9953a3a 100644 --- a/docs/rules/no-unsupported-features/es-builtins.md +++ b/docs/rules/no-unsupported-features/es-builtins.md @@ -27,19 +27,19 @@ For example of `package.json`: "name": "your-module", "version": "1.0.0", "engines": { - "node": ">=8.0.0" + "node": ">=10.0.0" } } ``` -If you omit the [engines] field, this rule chooses `>=8.0.0` as the configured Node.js version since `8` is the minimum version the community is maintaining (see also [Node.js Release Working Group](https://github.com/nodejs/Release#readme)). +If you omit the [engines] field, this rule chooses `>=10.0.0` as the configured Node.js version since `10` is the minimum version the community is maintaining (see also [Node.js Release Working Group](https://github.com/nodejs/Release#readme)). ### Options ```json { "node/no-unsupported-features/es-builtins": ["error", { - "version": ">=8.0.0", + "version": ">=10.0.0", "ignores": [] }] } diff --git a/docs/rules/no-unsupported-features/es-syntax.md b/docs/rules/no-unsupported-features/es-syntax.md index 24ed7c6d..0da2ba25 100644 --- a/docs/rules/no-unsupported-features/es-syntax.md +++ b/docs/rules/no-unsupported-features/es-syntax.md @@ -30,19 +30,19 @@ For example of `package.json`: "name": "your-module", "version": "1.0.0", "engines": { - "node": ">=8.0.0" + "node": ">=10.0.0" } } ``` -If you omit the [engines] field, this rule chooses `>=8.0.0` as the configured Node.js version since `8` is the minimum version the community is maintaining (see also [Node.js Release Working Group](https://github.com/nodejs/Release#readme)). +If you omit the [engines] field, this rule chooses `>=10.0.0` as the configured Node.js version since `10` is the minimum version the community is maintaining (see also [Node.js Release Working Group](https://github.com/nodejs/Release#readme)). ### Options ```json { "node/no-unsupported-features/es-syntax": ["error", { - "version": ">=8.0.0", + "version": ">=10.0.0", "ignores": [] }] } diff --git a/docs/rules/no-unsupported-features/node-builtins.md b/docs/rules/no-unsupported-features/node-builtins.md index 456fdbe6..126b71e7 100644 --- a/docs/rules/no-unsupported-features/node-builtins.md +++ b/docs/rules/no-unsupported-features/node-builtins.md @@ -24,19 +24,19 @@ For example of `package.json`: "name": "your-module", "version": "1.0.0", "engines": { - "node": ">=8.0.0" + "node": ">=10.0.0" } } ``` -If you omit the [engines] field, this rule chooses `>=8.0.0` as the configured Node.js version since `8` is the minimum version the community is maintaining (see also [Node.js Release Working Group](https://github.com/nodejs/Release#readme)). +If you omit the [engines] field, this rule chooses `>=10.0.0` as the configured Node.js version since `10` is the minimum version the community is maintaining (see also [Node.js Release Working Group](https://github.com/nodejs/Release#readme)). ### Options ```json { "node/no-unsupported-features/node-builtins": ["error", { - "version": ">=8.0.0", + "version": ">=10.0.0", "ignores": [] }] } diff --git a/lib/rules/no-unsupported-features.js b/lib/rules/no-unsupported-features.js index 73d422f7..fb28c31e 100644 --- a/lib/rules/no-unsupported-features.js +++ b/lib/rules/no-unsupported-features.js @@ -31,7 +31,7 @@ const VERSION_SCHEMA = { }, ], } -const DEFAULT_VERSION = "4.0.0" +const DEFAULT_VERSION = "10.0.0" const FUNC_TYPE = /^(?:Arrow)?Function(?:Declaration|Expression)$/u const CLASS_TYPE = /^Class(?:Declaration|Expression)$/u const DESTRUCTURING_PARENT_TYPE = /^(?:Function(?:Declaration|Expression)|ArrowFunctionExpression|AssignmentExpression|VariableDeclarator)$/u diff --git a/lib/util/get-configured-node-version.js b/lib/util/get-configured-node-version.js index d682e3a0..c48f77a4 100644 --- a/lib/util/get-configured-node-version.js +++ b/lib/util/get-configured-node-version.js @@ -23,7 +23,7 @@ function getEnginesNode(filename) { * * 1. Parse a given version then return it if it's valid. * 2. Look package.json up and parse `engines.node` then return it if it's valid. - * 3. Return `>=8.0.0`. + * 3. Return `>=10.0.0`. * * @param {string|undefined} version The version range text. * @param {string} filename The path to the current linting file. @@ -34,6 +34,6 @@ module.exports = function getConfiguredNodeVersion(version, filename) { return ( getSemverRange(version) || getEnginesNode(filename) || - getSemverRange(">=8.0.0") + getSemverRange(">=10.0.0") ) } diff --git a/package.json b/package.json index 8e23f2ea..54b8be6c 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "version": "11.1.0", "description": "Additional ESLint's rules for Node.js", "engines": { - "node": ">=8.10.0" + "node": "^10.0.0 || ^12.0.0 || >=14.0.0" }, "main": "lib/index.js", "files": [ @@ -14,7 +14,7 @@ }, "dependencies": { "eslint-plugin-es": "^4.1.0", - "eslint-utils": "^2.0.0", + "eslint-utils": "^3.0.0", "ignore": "^5.1.1", "is-core-module": "^2.3.0", "minimatch": "^3.0.4",