Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update eslint-utils to latest #308

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 23 additions & 73 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,100 +13,50 @@ 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
run: npm run -s lint

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
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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"
}
}
```
Expand Down
6 changes: 3 additions & 3 deletions docs/rules/no-deprecated-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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": []
}]
Expand Down
4 changes: 2 additions & 2 deletions docs/rules/no-unsupported-features.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
6 changes: 3 additions & 3 deletions docs/rules/no-unsupported-features/es-builtins.md
Original file line number Diff line number Diff line change
Expand Up @@ -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": []
}]
}
Expand Down
6 changes: 3 additions & 3 deletions docs/rules/no-unsupported-features/es-syntax.md
Original file line number Diff line number Diff line change
Expand Up @@ -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": []
}]
}
Expand Down
6 changes: 3 additions & 3 deletions docs/rules/no-unsupported-features/node-builtins.md
Original file line number Diff line number Diff line change
Expand Up @@ -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": []
}]
}
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/no-unsupported-features.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions lib/util/get-configured-node-version.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -34,6 +34,6 @@ module.exports = function getConfiguredNodeVersion(version, filename) {
return (
getSemverRange(version) ||
getEnginesNode(filename) ||
getSemverRange(">=8.0.0")
getSemverRange(">=10.0.0")
)
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand All @@ -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",
Expand Down