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

BREAKING: Update ESLint from v7 to v8 #233

Merged
merged 1 commit into from
Aug 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/lint-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ jobs:
key: yarn-cache-${{ runner.os }}-${{ steps.yarn-version.outputs.YARN_VERSION }}-${{ hashFiles('yarn.lock') }}
- run: yarn --frozen-lockfile
- run: yarn allow-scripts
- run: yarn patch-package
- run: yarn lint # "Testing" (i.e. config validation) is also done here
- name: Validate RC changelog
if: ${{ startsWith(github.ref, 'release/') }}
Expand Down
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"node": ">=14.0.0"
},
"scripts": {
"setup": "yarn install && yarn allow-scripts",
"setup": "yarn install && yarn allow-scripts && yarn patch-package",
"lint:eslint": "yarn eslint . --ext ts,js",
"lint:config-validation": "node ./scripts/validate-configs.js",
"lint:misc": "prettier '**/*.json' '**/*.md' '!**/CHANGELOG.md' '**/*.yml' --ignore-path .gitignore",
Expand All @@ -17,16 +17,17 @@
"packages/*"
],
"devDependencies": {
"@eslint/eslintrc": "^0.4.0",
"@eslint/eslintrc": "^1.3.0",
"@lavamoat/allow-scripts": "^2.0.3",
"@metamask/auto-changelog": "^2.3.0",
"eslint": "^7.23.0",
"eslint": "^8.21.0",
"eslint-config-prettier": "^8.1.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jsdoc": "^39.2.9",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^3.3.1",
"fast-deep-equal": "^3.1.3",
"patch-package": "^6.4.7",
"prettier": "^2.2.1"
},
"lavamoat": {
Expand Down
8 changes: 4 additions & 4 deletions packages/base/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,17 @@
},
"homepage": "/~https://github.com/MetaMask/eslint-config#readme",
"devDependencies": {
"eslint": "^7.23.0",
"eslint": "^8.21.0",
"eslint-config-prettier": "^8.1.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jsdoc": "^39.2.9",
"eslint-plugin-prettier": "^4.2.1",
"prettier": "^2.2.1"
},
"peerDependencies": {
"eslint": "^7.23.0",
"eslint": "^8.21.0",
"eslint-config-prettier": "^8.1.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jsdoc": "^39.2.9",
"eslint-plugin-prettier": "^4.2.1",
"prettier": "^2.2.1"
Expand Down
4 changes: 4 additions & 0 deletions packages/base/rules-snapshot.json
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@
"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": "off",
"no-mixed-spaces-and-tabs": "off",
Expand All @@ -277,6 +278,7 @@
"no-new-object": "error",
"no-new-symbol": "error",
"no-new-wrappers": "error",
"no-nonoctal-decimal-escape": "error",
"no-obj-calls": "error",
"no-octal": "error",
"no-octal-escape": "error",
Expand Down Expand Up @@ -327,6 +329,7 @@
"no-unreachable": "error",
"no-unsafe-finally": "error",
"no-unsafe-negation": "error",
"no-unsafe-optional-chaining": "error",
"no-unused-expressions": [
"error",
{
Expand All @@ -350,6 +353,7 @@
"functions": false
}
],
"no-useless-backreference": "error",
"no-useless-call": "error",
"no-useless-catch": "error",
"no-useless-computed-key": "error",
Expand Down
4 changes: 2 additions & 2 deletions packages/jest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@
"homepage": "/~https://github.com/MetaMask/eslint-config#readme",
"devDependencies": {
"@metamask/eslint-config": "^9.0.0",
"eslint": "^7.23.0",
"eslint": "^8.21.0",
"eslint-plugin-jest": "^26.8.2"
},
"peerDependencies": {
"@metamask/eslint-config": "^9.0.0",
"eslint": "^7.23.0",
"eslint": "^8.21.0",
"eslint-plugin-jest": "^26.8.2"
}
}
4 changes: 2 additions & 2 deletions packages/mocha/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@
"homepage": "/~https://github.com/MetaMask/eslint-config#readme",
"devDependencies": {
"@metamask/eslint-config": "^9.0.0",
"eslint": "^7.23.0",
"eslint": "^8.21.0",
"eslint-plugin-mocha": "^10.1.0"
},
"peerDependencies": {
"@metamask/eslint-config": "^9.0.0",
"eslint": "^7.23.0",
"eslint": "^8.21.0",
"eslint-plugin-mocha": "^10.1.0"
}
}
4 changes: 2 additions & 2 deletions packages/nodejs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@
"homepage": "/~https://github.com/MetaMask/eslint-config#readme",
"devDependencies": {
"@metamask/eslint-config": "^9.0.0",
"eslint": "^7.23.0",
"eslint": "^8.21.0",
"eslint-plugin-node": "^11.1.0"
},
"peerDependencies": {
"@metamask/eslint-config": "^9.0.0",
"eslint": "^7.23.0",
"eslint": "^8.21.0",
"eslint-plugin-node": "^11.1.0"
}
}
4 changes: 2 additions & 2 deletions packages/typescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@
"@metamask/eslint-config": "^9.0.0",
"@typescript-eslint/eslint-plugin": "^5.33.0",
"@typescript-eslint/parser": "^5.33.0",
"eslint": "^7.23.0",
"eslint": "^8.21.0",
"typescript": "^4.0.7"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should bump this eventually along with the other typescript packages, but not necessary now.

},
"peerDependencies": {
"@metamask/eslint-config": "^9.0.0",
"@typescript-eslint/eslint-plugin": "^5.33.0",
"@typescript-eslint/parser": "^5.33.0",
"eslint": "^7.23.0",
"eslint": "^8.21.0",
"typescript": "^4.0.7"
}
}
20 changes: 20 additions & 0 deletions patches/eslint+8.21.0.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
diff --git a/node_modules/eslint/lib/api.js b/node_modules/eslint/lib/api.js
index 3dde098..2118593 100644
--- a/node_modules/eslint/lib/api.js
+++ b/node_modules/eslint/lib/api.js
@@ -13,6 +13,7 @@ const { ESLint } = require("./eslint");
const { Linter } = require("./linter");
const { RuleTester } = require("./rule-tester");
const { SourceCode } = require("./source-code");
+const recommendedConfig = require("../conf/eslint-recommended");

//-----------------------------------------------------------------------------
// Exports
@@ -22,5 +23,6 @@ module.exports = {
Linter,
ESLint,
RuleTester,
- SourceCode
+ SourceCode,
+ recommendedConfig
};
2 changes: 1 addition & 1 deletion scripts/validate-configs.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const { readdirSync, readFileSync, promises: fs } = require('fs');
const pathUtils = require('path');
const { FlatCompat } = require('@eslint/eslintrc');
const eslintRecommendedConfig = require('eslint/conf/eslint-recommended');
const { recommendedConfig: eslintRecommendedConfig } = require('eslint');
const {
configs: { recommended: prettierConfig },
} = require('eslint-plugin-prettier');
Expand Down
Loading