From 46db14d1f7008e0a196abc8940146dd5ef04a761 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20De=20Boey?= Date: Sat, 16 May 2020 18:08:38 +0200 Subject: [PATCH] feat: support ESLint 7.x --- .github/workflows/CI.yml | 14 +++++++++----- README.md | 2 +- lib/configs/_base.js | 13 ++++++++++--- lib/configs/_override-special.js | 2 -- package.json | 5 +++-- tests/lib/configs/_rules.js | 2 +- 6 files changed, 24 insertions(+), 14 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 3dcabbb..2537599 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -41,17 +41,21 @@ jobs: matrix.os }}) strategy: matrix: - eslint: [6] + eslint: [7] node: [12.22.0, 12, 14.17.0, 14, 16, 18] os: [ubuntu-latest] include: # On other platforms - os: windows-latest - eslint: 6 + eslint: 7 node: 18 - os: macos-latest - eslint: 6 + eslint: 7 node: 18 + # On old ESLint versions + - eslint: 6 + node: 18 + os: ubuntu-latest # On the minimum supported ESLint/Node.js version - eslint: 6.6.0 node: 12.22.0 @@ -72,8 +76,8 @@ jobs: - name: 📥 Install dependencies run: npm install - # - name: 📥 Install ESLint v${{ matrix.eslint }} - # run: npm install --save-dev eslint@${{ matrix.eslint }} + - name: 📥 Install ESLint v${{ matrix.eslint }} + run: npm install --save-dev eslint@${{ matrix.eslint }} - name: ▶️ Run test script run: npm run test diff --git a/README.md b/README.md index 3e3e150..8974465 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ npm install --save-dev eslint @eslint-community/eslint-plugin-mysticatea ### Requirements - Node.js `^12.22.0 || ^14.17.0 || >=16.0.0` or newer versions. -- ESLint `^6.6.0` or newer versions. +- ESLint `^6.6.0 || ^7.0.0` or newer versions. ## 📖 Usage diff --git a/lib/configs/_base.js b/lib/configs/_base.js index ad6956b..bd0ba06 100644 --- a/lib/configs/_base.js +++ b/lib/configs/_base.js @@ -27,6 +27,7 @@ module.exports = { "consistent-return": "error", curly: "error", "default-case": "error", + "default-case-last": "error", "default-param-last": "error", "dot-notation": "error", eqeqeq: ["error", "always", { null: "ignore" }], @@ -92,6 +93,7 @@ module.exports = { "no-lone-blocks": "error", "no-lonely-if": "error", "no-loop-func": "error", + "no-loss-of-precision": "error", "no-misleading-character-class": "error", "no-mixed-operators": [ "error", @@ -106,12 +108,14 @@ module.exports = { "no-new-object": "error", "no-new-require": "error", "no-new-wrappers": "error", + "no-nonoctal-decimal-escape": "error", "no-obj-calls": "error", "no-octal": "error", "no-octal-escape": "error", "no-param-reassign": ["error", { props: false }], "no-process-env": "error", "no-process-exit": "error", + "no-promise-executor-return": "error", "no-prototype-builtins": "error", "no-redeclare": ["error", { builtinGlobals: true }], "no-regex-spaces": "error", @@ -142,8 +146,10 @@ module.exports = { "no-unmodified-loop-condition": "error", "no-unneeded-ternary": "error", "no-unreachable": "error", + "no-unreachable-loop": "error", "no-unsafe-finally": "error", "no-unsafe-negation": ["error", { enforceForOrderingRelations: true }], + "no-unsafe-optional-chaining": "error", "no-unused-expressions": "error", "no-unused-labels": "error", "no-unused-vars": [ @@ -157,6 +163,7 @@ module.exports = { }, ], "no-use-before-define": ["error", "nofunc"], + "no-useless-backreference": "error", "no-useless-call": "error", "no-useless-catch": "error", "no-useless-concat": "error", @@ -299,6 +306,7 @@ module.exports = { "guard-for-in": "off", "handle-callback-err": "off", "id-blacklist": "off", + "id-denylist": "off", "id-length": "off", "id-match": "off", "line-comment-position": "off", @@ -332,6 +340,7 @@ module.exports = { "no-path-concat": "off", "no-plusplus": "off", "no-proto": "off", + "no-restricted-exports": "off", "no-restricted-globals": "off", "no-restricted-imports": "off", "no-restricted-modules": "off", @@ -409,9 +418,7 @@ module.exports = { semi: false, tabWidth: 4, }, - { - usePrettierrc: false, - }, + { usePrettierrc: false }, ], // my own diff --git a/lib/configs/_override-special.js b/lib/configs/_override-special.js index 17916c0..e24a2fa 100644 --- a/lib/configs/_override-special.js +++ b/lib/configs/_override-special.js @@ -18,7 +18,6 @@ module.exports = { extends: [require.resolve("./+node.js")], rules: { "no-console": "off", - "no-process-env": "off", }, }, { @@ -33,7 +32,6 @@ module.exports = { ], rules: { "no-console": "off", - "no-process-env": "off", }, }, ], diff --git a/package.json b/package.json index f56d74e..8a21960 100644 --- a/package.json +++ b/package.json @@ -53,8 +53,9 @@ "vue-eslint-parser": "^8.3.0" }, "devDependencies": { + "@eslint/eslintrc": "^0.4.3", "@eslint-community/eslint-plugin-mysticatea": "file:.", - "eslint": "~6.8.0", + "eslint": "~7.32.0", "globals": "^13.17.0", "mocha": "^9.2.2", "npm-run-all": "^4.1.5", @@ -64,7 +65,7 @@ "typescript": "^4.8.4" }, "peerDependencies": { - "eslint": ">=6.6.0" + "eslint": "^6.6.0 || ^7.0.0" }, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" diff --git a/tests/lib/configs/_rules.js b/tests/lib/configs/_rules.js index a70105d..7d603c8 100644 --- a/tests/lib/configs/_rules.js +++ b/tests/lib/configs/_rules.js @@ -7,7 +7,7 @@ const { Linter } = require("eslint") const { ConfigArrayFactory, -} = require("eslint/lib/cli-engine/config-array-factory") +} = require("@eslint/eslintrc/lib/config-array-factory") const Validator = require("eslint/lib/shared/config-validator") const { rules: removedRules } = require("eslint/conf/replacements.json") const {