From 4f2d4f046fc62ff7ac70340b0e0cfbf093153fc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20De=20Boey?= Date: Sun, 10 Oct 2021 21:00:44 +0200 Subject: [PATCH] feat: support ESLint 8.x BREAKING CHANGE: Requires Node@^12.22.0 || ^14.17.0 || >=16.0.0 BREAKING CHANGE: Requires ESLint@^8.0.0 --- .travis.yml | 2 +- README.md | 8 ++--- configurations/eslintrc.json | 16 ++++----- package.json | 41 +++++++++++------------ test/eslint-config-canonical/canonical.js | 6 ++-- 5 files changed, 36 insertions(+), 37 deletions(-) diff --git a/.travis.yml b/.travis.yml index f48d67e..939d5a1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,7 @@ dist: focal arch: arm64-graviton2 language: node_js node_js: - - 10 + - 12 script: - npm run test after_success: diff --git a/README.md b/README.md index 22b0b89..c217228 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,10 @@ This is how Canonical ruleset compares to other popular configurations. |Rule|Canonical|[Airbnb](https://www.npmjs.com/package/eslint-config-airbnb)|[Google](https://www.npmjs.com/package/eslint-config-google)|[Standard](https://www.npmjs.com/package/eslint-config-standard)| |---|---|---|---|---| +|`@babel/new-cap`|off|N/A 👻|N/A 👻|N/A 👻| +|`@babel/no-invalid-this`|error 🚨|N/A 👻|N/A 👻|N/A 👻| +|`@babel/object-curly-spacing`|error 🚨|N/A 👻|N/A 👻|N/A 👻| +|`@babel/valid-typeof`|error 🚨|N/A 👻|N/A 👻|N/A 👻| |[`@typescript-eslint/@typescript-eslint/explicit-member-accessibility`](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/@typescript-eslint/explicit-member-accessibility.md)|off|N/A 👻|N/A 👻|N/A 👻| |[`@typescript-eslint/adjacent-overload-signatures`](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/adjacent-overload-signatures.md)|error 🚨|N/A 👻|N/A 👻|N/A 👻| |[`@typescript-eslint/array-type`](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/array-type.md)|error 🚨|N/A 👻|N/A 👻|N/A 👻| @@ -174,10 +178,6 @@ This is how Canonical ruleset compares to other popular configurations. |[`ava/use-t-well`](https://github.com/avajs/eslint-plugin-ava/blob/master/docs/rules/use-t-well.md)|error 🚨|N/A 👻|N/A 👻|N/A 👻| |[`ava/use-test`](https://github.com/avajs/eslint-plugin-ava/blob/master/docs/rules/use-test.md)|error 🚨|N/A 👻|N/A 👻|N/A 👻| |[`ava/use-true-false`](https://github.com/avajs/eslint-plugin-ava/blob/master/docs/rules/use-true-false.md)|error 🚨|N/A 👻|N/A 👻|N/A 👻| -|`babel/new-cap`|off|N/A 👻|N/A 👻|N/A 👻| -|`babel/no-invalid-this`|error 🚨|N/A 👻|N/A 👻|N/A 👻| -|`babel/object-curly-spacing`|error 🚨|N/A 👻|N/A 👻|N/A 👻| -|`babel/valid-typeof`|error 🚨|N/A 👻|N/A 👻|N/A 👻| |[`block-scoped-var`](https://eslint.org/docs/rules/block-scoped-var)|error 🚨|error 🚨|N/A 👻|N/A 👻| |[`block-spacing`](https://eslint.org/docs/rules/block-spacing)|error 🚨|error 🚨|error 🚨|error 🚨| |[`brace-style`](https://eslint.org/docs/rules/brace-style)|error 🚨|error 🚨|error 🚨|error 🚨| diff --git a/configurations/eslintrc.json b/configurations/eslintrc.json index 2b06367..fa1e035 100644 --- a/configurations/eslintrc.json +++ b/configurations/eslintrc.json @@ -20,7 +20,7 @@ "sort-keys-fix", "fp", "no-use-extend-native", - "babel", + "@babel", "import", "jsdoc", "promise", @@ -29,6 +29,13 @@ "eslint-comments" ], "rules": { + "@babel/new-cap": 0, + "@babel/no-invalid-this": 2, + "@babel/object-curly-spacing": [ + 2, + "never" + ], + "@babel/valid-typeof": 2, "accessor-pairs": 2, "array-bracket-newline": 0, "array-bracket-spacing": [ @@ -55,13 +62,6 @@ "before": true } ], - "babel/new-cap": 0, - "babel/no-invalid-this": 2, - "babel/object-curly-spacing": [ - 2, - "never" - ], - "babel/valid-typeof": 2, "block-scoped-var": 2, "block-spacing": [ 2, diff --git a/package.json b/package.json index ff40aaa..c8be987 100644 --- a/package.json +++ b/package.json @@ -18,44 +18,43 @@ ] }, "dependencies": { - "@babel/eslint-parser": "^7.13.14", - "@typescript-eslint/eslint-plugin": "^4.22.0", - "@typescript-eslint/parser": "^4.22.0", - "eslint-plugin-ava": "^12.0.0", - "eslint-plugin-babel": "^5.3.1", - "eslint-plugin-cypress": "^2.11.2", + "@babel/eslint-parser": "^7.15.8", + "@babel/eslint-plugin": "^7.14.5", + "@typescript-eslint/eslint-plugin": "^5.0.0-0", + "@typescript-eslint/parser": "^5.0.0-0", + "eslint-plugin-ava": "^13.0.0", + "eslint-plugin-cypress": "^2.12.1", "eslint-plugin-eslint-comments": "^3.2.0", "eslint-plugin-filenames": "^1.3.2", - "eslint-plugin-flowtype": "^5.7.1", + "eslint-plugin-flowtype": "^6.1.0", "eslint-plugin-fp": "^2.3.0", - "eslint-plugin-import": "^2.22.1", - "eslint-plugin-jest": "^24.3.5", - "eslint-plugin-jsdoc": "^32.3.0", - "eslint-plugin-lodash": "^7.2.0", - "eslint-plugin-mocha": "^8.1.0", - "eslint-plugin-modules-newline": "0.0.6", + "eslint-plugin-import": "^2.25.2", + "eslint-plugin-jest": "^25.0.1", + "eslint-plugin-jsdoc": "^36.1.1", + "eslint-plugin-lodash": "^7.3.0", + "eslint-plugin-mocha": "^9.0.0", "eslint-plugin-no-use-extend-native": "^0.5.0", "eslint-plugin-node": "^11.1.0", "eslint-plugin-promise": "^5.1.0", - "eslint-plugin-react": "^7.23.2", + "eslint-plugin-react": "^7.26.1", "eslint-plugin-react-hooks": "^4.2.0", - "eslint-plugin-sort-keys-fix": "^1.1.1", + "eslint-plugin-sort-keys-fix": "^1.1.2", "eslint-plugin-typescript-sort-keys": "^1.8.0", - "eslint-plugin-unicorn": "^30.0.0" + "eslint-plugin-unicorn": "^37.0.0" }, "description": "Canonical ESLint Shareable Config", "devDependencies": { "@ava/babel": "^1.0.1", - "@babel/core": "^7.13.16", - "@babel/register": "^7.13.16", + "@babel/core": "^7.15.8", + "@babel/register": "^7.15.3", "ava": "^3.15.0", - "eslint": "^7.24.0", + "eslint": "^8.0.0", "husky": "^4.3.8", "jsonlint": "^1.6.3", "semantic-release": "^17.4.2" }, "engines": { - "node": ">=10.0.0" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" }, "husky": { "hooks": { @@ -71,7 +70,7 @@ "main": "./eslintrc.js", "name": "eslint-config-canonical", "peerDependencies": { - "eslint": "^6.0.0 || ^7.0.0" + "eslint": "^8.0.0" }, "repository": { "type": "git", diff --git a/test/eslint-config-canonical/canonical.js b/test/eslint-config-canonical/canonical.js index ea825df..69735f1 100644 --- a/test/eslint-config-canonical/canonical.js +++ b/test/eslint-config-canonical/canonical.js @@ -1,5 +1,5 @@ const test = require('ava'); -const CLIEngine = require('eslint').CLIEngine; +const {ESLint} = require('eslint'); const configurations = [ 'ava', @@ -16,8 +16,8 @@ for (const configuration of configurations) { // eslint-disable-next-line import/no-dynamic-require -- Safe as for testing const config = require('../../' + configuration); - const rulesDefinition = new CLIEngine({ - configFile: './' + configuration + '.js', + const rulesDefinition = new ESLint({ + overrideConfigFile: './' + configuration + '.js', useEslintrc: false, }) .getRules();