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

feat: support ESLint 8.x #295

Draft
wants to merge 11 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
105 changes: 37 additions & 68 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,90 +13,59 @@ 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: 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
os: [ubuntu-latest]
eslint: ["^8.0.0-0"]
MichaelDeBoey marked this conversation as resolved.
Show resolved Hide resolved
node: [16]
include:
# On other platforms
- eslint: "^8.0.0-0"
node: 16
os: windows-latest
- eslint: "^8.0.0-0"
node: 16
os: macos-latest
# On old Node.js versions
- eslint: "^8.0.0-0"
node: 14
os: ubuntu-latest
- eslint: "^8.0.0-0"
node: 12
os: ubuntu-latest
# On old ESLint versions
- eslint: 7
node: 16
os: ubuntu-latest
- eslint: 6
node: 16
os: ubuntu-latest
- eslint: 5
node: 16
os: ubuntu-latest
# On the minimum supported ESLint/Node.js version
- eslint: 5.16.0
node: 12.22.0
os: ubuntu-latest

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
Expand Down
168 changes: 83 additions & 85 deletions README.md

Large diffs are not rendered by default.

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
2 changes: 1 addition & 1 deletion lib/rules/no-extraneous-import.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ module.exports = {
url:
"https://github.com/mysticatea/eslint-plugin-node/blob/v11.1.0/docs/rules/no-extraneous-import.md",
},
type: "problem",
fixable: null,
schema: [
{
Expand All @@ -35,6 +34,7 @@ module.exports = {
additionalProperties: false,
},
],
type: "problem",
},
create(context) {
const filePath = context.getFilename()
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/no-extraneous-require.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ module.exports = {
url:
"https://github.com/mysticatea/eslint-plugin-node/blob/v11.1.0/docs/rules/no-extraneous-require.md",
},
type: "problem",
fixable: null,
schema: [
{
Expand All @@ -35,6 +34,7 @@ module.exports = {
additionalProperties: false,
},
],
type: "problem",
},
create(context) {
const filePath = context.getFilename()
Expand Down
4 changes: 2 additions & 2 deletions lib/rules/no-hide-core-modules.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ const BACK_SLASH = /\\/gu

module.exports = {
meta: {
deprecated: true,
docs: {
description:
"disallow third-party modules which are hiding core modules",
Expand All @@ -58,8 +59,6 @@ module.exports = {
url:
"https://github.com/mysticatea/eslint-plugin-node/blob/v11.1.0/docs/rules/no-hide-core-modules.md",
},
type: "problem",
deprecated: true,
fixable: null,
schema: [
{
Expand All @@ -77,6 +76,7 @@ module.exports = {
additionalProperties: false,
},
],
type: "problem",
},
create(context) {
if (context.getFilename() === "<input>") {
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/no-missing-import.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ module.exports = {
url:
"https://github.com/mysticatea/eslint-plugin-node/blob/v11.1.0/docs/rules/no-missing-import.md",
},
type: "problem",
fixable: null,
schema: [
{
Expand All @@ -33,6 +32,7 @@ module.exports = {
additionalProperties: false,
},
],
type: "problem",
},
create(context) {
const filePath = context.getFilename()
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/no-missing-require.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ module.exports = {
url:
"https://github.com/mysticatea/eslint-plugin-node/blob/v11.1.0/docs/rules/no-missing-require.md",
},
type: "problem",
fixable: null,
schema: [
{
Expand All @@ -33,6 +32,7 @@ module.exports = {
additionalProperties: false,
},
],
type: "problem",
},
create(context) {
const filePath = context.getFilename()
Expand Down
12 changes: 6 additions & 6 deletions lib/rules/no-mixed-requires.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ const BUILTIN_MODULES = [

module.exports = {
meta: {
type: "suggestion",
docs: {
description:
"disallow `require` calls to be mixed with regular variable declarations",
Expand All @@ -77,6 +76,11 @@ module.exports = {
"https://github.com/mysticatea/eslint-plugin-node/blob/v11.1.0/docs/rules/no-mixed-requires.md",
},
fixable: null,
messages: {
noMixRequire: "Do not mix 'require' and other declarations.",
noMixCoreModuleFileComputed:
"Do not mix core, module, file and computed requires.",
},
schema: [
{
oneOf: [
Expand All @@ -98,11 +102,7 @@ module.exports = {
],
},
],
messages: {
noMixRequire: "Do not mix 'require' and other declarations.",
noMixCoreModuleFileComputed:
"Do not mix core, module, file and computed requires.",
},
type: "suggestion",
},

create(context) {
Expand Down