Skip to content

Commit

Permalink
feat!: support eslint v8 (#1)
Browse files Browse the repository at this point in the history
* breaking: drop node < 12
* feat: support eslint v8
* drop support eslint < v7
  • Loading branch information
aladdin-add authored Nov 29, 2021
1 parent a7a03c8 commit fcfff1f
Show file tree
Hide file tree
Showing 44 changed files with 172 additions and 203 deletions.
141 changes: 75 additions & 66 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,70 +4,79 @@
*/
"use strict"

const version = require("./package.json").version

// the config does not support eslint v8 yet, just replaced it with a simple config,
// to make the ci passing.
module.exports = {
extends: ["plugin:@mysticatea/es2015", "plugin:@mysticatea/+eslint-plugin"],
rules: {
"@mysticatea/eslint-plugin/test-case-property-ordering": [
"error",
[
"filename",
"code",
"output",
"options",
"parser",
"parserOptions",
"globals",
"env",
"errors",
],
],
},
overrides: [
{
files: ["**/rules/*.js"],
rules: {
"@mysticatea/eslint-plugin/require-meta-docs-url": [
"error",
{
pattern: `https://github.com/mysticatea/eslint-plugin-node/blob/v${version}/docs/rules/{{name}}.md`,
},
],
},
},
{
files: ["**/rules/no-unsupported-features/*.js"],
rules: {
"@mysticatea/eslint-plugin/require-meta-docs-url": [
"error",
{
pattern: `https://github.com/mysticatea/eslint-plugin-node/blob/v${version}/docs/rules/no-unsupported-features/{{name}}.md`,
},
],
},
},
{
files: ["**/rules/prefer-global/*.js"],
rules: {
"@mysticatea/eslint-plugin/require-meta-docs-url": [
"error",
{
pattern: `https://github.com/mysticatea/eslint-plugin-node/blob/v${version}/docs/rules/prefer-global/{{name}}.md`,
},
],
},
},
{
files: ["**/rules/prefer-promises/*.js"],
rules: {
"@mysticatea/eslint-plugin/require-meta-docs-url": [
"error",
{
pattern: `https://github.com/mysticatea/eslint-plugin-node/blob/v${version}/docs/rules/prefer-promises/{{name}}.md`,
},
],
},
},
],
}
extends: ["eslint:recommended", "plugin:node/recommended", "plugin:eslint-plugin/recommended"],
env: {
mocha: true,
}
};

// const version = require("./package.json").version

// module.exports = {
// extends: ["plugin:@mysticatea/es2015", "plugin:@mysticatea/+eslint-plugin"],
// rules: {
// "@mysticatea/eslint-plugin/test-case-property-ordering": [
// "error",
// [
// "filename",
// "code",
// "output",
// "options",
// "parser",
// "parserOptions",
// "globals",
// "env",
// "errors",
// ],
// ],
// },
// overrides: [
// {
// files: ["**/rules/*.js"],
// rules: {
// "@mysticatea/eslint-plugin/require-meta-docs-url": [
// "error",
// {
// pattern: `https://github.com/mysticatea/eslint-plugin-node/blob/v${version}/docs/rules/{{name}}.md`,
// },
// ],
// },
// },
// {
// files: ["**/rules/no-unsupported-features/*.js"],
// rules: {
// "@mysticatea/eslint-plugin/require-meta-docs-url": [
// "error",
// {
// pattern: `https://github.com/mysticatea/eslint-plugin-node/blob/v${version}/docs/rules/no-unsupported-features/{{name}}.md`,
// },
// ],
// },
// },
// {
// files: ["**/rules/prefer-global/*.js"],
// rules: {
// "@mysticatea/eslint-plugin/require-meta-docs-url": [
// "error",
// {
// pattern: `https://github.com/mysticatea/eslint-plugin-node/blob/v${version}/docs/rules/prefer-global/{{name}}.md`,
// },
// ],
// },
// },
// {
// files: ["**/rules/prefer-promises/*.js"],
// rules: {
// "@mysticatea/eslint-plugin/require-meta-docs-url": [
// "error",
// {
// pattern: `https://github.com/mysticatea/eslint-plugin-node/blob/v${version}/docs/rules/prefer-promises/{{name}}.md`,
// },
// ],
// },
// },
// ],
// }
74 changes: 15 additions & 59 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
uses: actions/checkout@v2
with:
fetch-depth: 1
- name: Install Node.js
uses: actions/setup-node@v1
uses: actions/setup-node@v2
with:
node: 12.x
node: 16.x
- name: Install Packages
run: npm install
- name: Lint
Expand All @@ -31,72 +31,28 @@ jobs:
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.
eslint: [8.x, 7.x]
node: [16.x]
include:
# run on node lts(ubuntu-latest)
- os: ubuntu-latest
eslint: 5.x
node: 13.x
node: "12.x"
eslint: "8.x"
- os: ubuntu-latest
eslint: 5.x
node: 10.x
node: "14.x"
eslint: "8.x"
- os: ubuntu-latest
eslint: 5.x
node: 8.x
node: "17.x"
eslint: "8.x"

runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v1
uses: actions/checkout@v2
with:
fetch-depth: 1
- 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
2 changes: 1 addition & 1 deletion lib/rules/callback-return.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module.exports = {
category: "Stylistic Issues",
recommended: false,
url:
"https://github.com/mysticatea/eslint-plugin-node/blob/v12.0.0/docs/rules/callback-return.md",
"https://github.com/mysticatea/eslint-plugin-node/blob/HEAD/docs/rules/callback-return.md",
},
schema: [
{
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 @@ -146,7 +146,7 @@ module.exports = {
category: "Stylistic Issues",
recommended: false,
url:
"https://github.com/mysticatea/eslint-plugin-node/blob/v12.0.0/docs/rules/exports-style.md",
"https://github.com/mysticatea/eslint-plugin-node/blob/HEAD/docs/rules/exports-style.md",
},
type: "suggestion",
fixable: null,
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/file-extension-in-import.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ module.exports = {
category: "Stylistic Issues",
recommended: false,
url:
"https://github.com/mysticatea/eslint-plugin-node/blob/v12.0.0/docs/rules/file-extension-in-import.md",
"https://github.com/mysticatea/eslint-plugin-node/blob/HEAD/docs/rules/file-extension-in-import.md",
},
fixable: "code",
messages: {
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/global-require.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ module.exports = {
category: "Stylistic Issues",
recommended: false,
url:
"https://github.com/mysticatea/eslint-plugin-node/blob/v12.0.0/docs/rules/global-require.md",
"https://github.com/mysticatea/eslint-plugin-node/blob/HEAD/docs/rules/global-require.md",
},
fixable: null,
schema: [],
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/handle-callback-err.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module.exports = {
category: "Possible Errors",
recommended: false,
url:
"https://github.com/mysticatea/eslint-plugin-node/blob/v12.0.0/docs/rules/handle-callback-err.md",
"https://github.com/mysticatea/eslint-plugin-node/blob/HEAD/docs/rules/handle-callback-err.md",
},
fixable: null,
schema: [
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 @@ -12,7 +12,7 @@ module.exports = {
category: "Possible Errors",
recommended: false,
url:
"https://github.com/mysticatea/eslint-plugin-node/blob/v12.0.0/docs/rules/no-callback-literal.md",
"https://github.com/mysticatea/eslint-plugin-node/blob/HEAD/docs/rules/no-callback-literal.md",
},
type: "problem",
fixable: null,
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/no-deprecated-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,7 @@ module.exports = {
category: "Best Practices",
recommended: true,
url:
"https://github.com/mysticatea/eslint-plugin-node/blob/v12.0.0/docs/rules/no-deprecated-api.md",
"https://github.com/mysticatea/eslint-plugin-node/blob/HEAD/docs/rules/no-deprecated-api.md",
},
type: "problem",
fixable: null,
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/no-exports-assign.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ module.exports = {
category: "Possible Errors",
recommended: true,
url:
"https://github.com/mysticatea/eslint-plugin-node/blob/v12.0.0/docs/rules/no-exports-assign.md",
"https://github.com/mysticatea/eslint-plugin-node/blob/HEAD/docs/rules/no-exports-assign.md",
},
fixable: null,
messages: {
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 @@ -19,7 +19,7 @@ module.exports = {
category: "Possible Errors",
recommended: true,
url:
"https://github.com/mysticatea/eslint-plugin-node/blob/v12.0.0/docs/rules/no-extraneous-import.md",
"https://github.com/mysticatea/eslint-plugin-node/blob/HEAD/docs/rules/no-extraneous-import.md",
},
type: "problem",
fixable: null,
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 @@ -19,7 +19,7 @@ module.exports = {
category: "Possible Errors",
recommended: true,
url:
"https://github.com/mysticatea/eslint-plugin-node/blob/v12.0.0/docs/rules/no-extraneous-require.md",
"https://github.com/mysticatea/eslint-plugin-node/blob/HEAD/docs/rules/no-extraneous-require.md",
},
type: "problem",
fixable: null,
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/no-hide-core-modules.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ module.exports = {
category: "Possible Errors",
recommended: false,
url:
"https://github.com/mysticatea/eslint-plugin-node/blob/v12.0.0/docs/rules/no-hide-core-modules.md",
"https://github.com/mysticatea/eslint-plugin-node/blob/HEAD/docs/rules/no-hide-core-modules.md",
},
type: "problem",
deprecated: true,
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 @@ -18,7 +18,7 @@ module.exports = {
category: "Possible Errors",
recommended: true,
url:
"https://github.com/mysticatea/eslint-plugin-node/blob/v12.0.0/docs/rules/no-missing-import.md",
"https://github.com/mysticatea/eslint-plugin-node/blob/HEAD/docs/rules/no-missing-import.md",
},
type: "problem",
fixable: null,
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 @@ -18,7 +18,7 @@ module.exports = {
category: "Possible Errors",
recommended: true,
url:
"https://github.com/mysticatea/eslint-plugin-node/blob/v12.0.0/docs/rules/no-missing-require.md",
"https://github.com/mysticatea/eslint-plugin-node/blob/HEAD/docs/rules/no-missing-require.md",
},
type: "problem",
fixable: null,
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/no-mixed-requires.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ module.exports = {
category: "Stylistic Issues",
recommended: false,
url:
"https://github.com/mysticatea/eslint-plugin-node/blob/v12.0.0/docs/rules/no-mixed-requires.md",
"https://github.com/mysticatea/eslint-plugin-node/blob/HEAD/docs/rules/no-mixed-requires.md",
},
fixable: null,
schema: [
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/no-new-require.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module.exports = {
category: "Possible Errors",
recommended: false,
url:
"https://github.com/mysticatea/eslint-plugin-node/blob/v12.0.0/docs/rules/no-new-require.md",
"https://github.com/mysticatea/eslint-plugin-node/blob/HEAD/docs/rules/no-new-require.md",
},
fixable: null,
schema: [],
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/no-path-concat.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ module.exports = {
category: "Possible Errors",
recommended: false,
url:
"https://github.com/mysticatea/eslint-plugin-node/blob/v12.0.0/docs/rules/no-path-concat.md",
"https://github.com/mysticatea/eslint-plugin-node/blob/HEAD/docs/rules/no-path-concat.md",
},
fixable: null,
schema: [],
Expand Down
Loading

0 comments on commit fcfff1f

Please sign in to comment.