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(CI): add tests for ESLint 7 #224

Draft
wants to merge 12 commits into
base: master
Choose a base branch
from
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: daily

- package-ecosystem: npm
directory: /
schedule:
interval: daily
98 changes: 25 additions & 73 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,100 +13,52 @@ 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: [7]
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: 6
node: 16
- 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
10 changes: 5 additions & 5 deletions lib/rules/callback-return.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,24 @@

module.exports = {
meta: {
type: "suggestion",
docs: {
description: "require `return` statements after callbacks",
category: "Stylistic Issues",
recommended: false,
url:
"https://github.com/mysticatea/eslint-plugin-node/blob/v11.1.0/docs/rules/callback-return.md",
},
fixable: null,
messages: {
missingReturn: "Expected return with your callback function.",
},
schema: [
{
type: "array",
items: { type: "string" },
},
],
fixable: null,
messages: {
missingReturn: "Expected return with your callback function.",
},
type: "suggestion",
},

create(context) {
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/exports-style.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ module.exports = {
url:
"https://github.com/mysticatea/eslint-plugin-node/blob/v11.1.0/docs/rules/exports-style.md",
},
type: "suggestion",
fixable: null,
schema: [
{
Expand All @@ -161,6 +160,7 @@ module.exports = {
additionalProperties: false,
},
],
type: "suggestion",
},

create(context) {
Expand Down
4 changes: 2 additions & 2 deletions lib/rules/global-require.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ function isShadowed(scope, node) {

module.exports = {
meta: {
type: "suggestion",
docs: {
description:
"require `require()` calls to be placed at top-level module scope",
Expand All @@ -59,10 +58,11 @@ module.exports = {
"https://github.com/mysticatea/eslint-plugin-node/blob/v11.1.0/docs/rules/global-require.md",
},
fixable: null,
schema: [],
messages: {
unexpected: "Unexpected require().",
},
schema: [],
type: "suggestion",
},

create(context) {
Expand Down
8 changes: 4 additions & 4 deletions lib/rules/handle-callback-err.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

module.exports = {
meta: {
type: "suggestion",
docs: {
description: "require error handling in callbacks",
category: "Possible Errors",
Expand All @@ -15,14 +14,15 @@ module.exports = {
"https://github.com/mysticatea/eslint-plugin-node/blob/v11.1.0/docs/rules/handle-callback-err.md",
},
fixable: null,
messages: {
expected: "Expected error to be handled.",
},
schema: [
{
type: "string",
},
],
messages: {
expected: "Expected error to be handled.",
},
type: "suggestion",
},

create(context) {
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/no-callback-literal.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ module.exports = {
url:
"https://github.com/mysticatea/eslint-plugin-node/blob/v11.1.0/docs/rules/no-callback-literal.md",
},
type: "problem",
fixable: null,
schema: [],
type: "problem",
},

create(context) {
Expand Down
6 changes: 3 additions & 3 deletions lib/rules/no-deprecated-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -659,8 +659,8 @@ function toName(type, path) {
return type === ReferenceTracker.CALL
? `${baseName}()`
: type === ReferenceTracker.CONSTRUCT
? `new ${baseName}()`
: baseName
? `new ${baseName}()`
: baseName
}

/**
Expand Down Expand Up @@ -688,7 +688,6 @@ module.exports = {
url:
"https://github.com/mysticatea/eslint-plugin-node/blob/v11.1.0/docs/rules/no-deprecated-api.md",
},
type: "problem",
fixable: null,
schema: [
{
Expand Down Expand Up @@ -720,6 +719,7 @@ module.exports = {
additionalProperties: false,
},
],
type: "problem",
},
create(context) {
const {
Expand Down
Loading