-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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: allow custom ESLint rules and add get-text-anti-pattern #27591
base: develop
Are you sure you want to change the base?
Conversation
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
New and removed dependencies detected. Learn more about Socket for GitHub ↗︎
🚮 Removed packages: npm/@esbuild/aix-ppc64@0.19.12, npm/@metamask/eslint-config-mocha@9.0.0, npm/get-tsconfig@4.7.5, npm/tsx@4.7.1 |
package.json
Outdated
@@ -546,6 +546,7 @@ | |||
"@types/yargs-parser": "^21.0.3", | |||
"@typescript-eslint/eslint-plugin": "^7.10.0", | |||
"@typescript-eslint/parser": "^7.10.0", | |||
"@typescript-eslint/utils": "^8.8.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The package @typescript-eslint/utils
was already implicitly included, but this makes it explicit
"tsx": "^4.7.1", | ||
"tsx": "^4.19.1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tsx
package was updated to the latest version in order to support require('tsx/cjs/api').register(tsconfig);
// Allow TypeScript to be used in Mocha | ||
require: ['tsx/esm'], | ||
'node-option': ['import=tsx'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mocha unit tests used to use ts-node
, this updates them to the newest tsx
3360e1e
to
de2e64b
Compare
de2e64b
to
6be006a
Compare
Quality Gate failedFailed conditions |
.eslintrc.js
Outdated
files: ['test/e2e/**/*.spec.js'], | ||
files: ['test/e2e/**/*.spec.{js,jsx,ts,tsx}'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doing this caused hundreds of new errors and warnings
7ae8a41
to
7e0e2e9
Compare
2406fe0
to
5dcf6b3
Compare
5dcf6b3
to
3c31f14
Compare
3c31f14
to
be3dc57
Compare
Builds ready [9b3104d]
Page Load Metrics (1788 ± 71 ms)
Bundle size diffs
|
<!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** Continuing the work of removing the e2e anti-pattern of finding the element and then asserting its text. There are more occurrences, but this work is split in several PRs, for an easy review and a faster ci. Once all occurrences have been fixed, we'll be able to merge @HowardBraham 's [PR ](#27591 adding a lint rule which prevents introducing it again. [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/28043?quickstart=1) ## **Related issues** Fixes: (but doesn't yet closes) #19870 ## **Manual testing steps** 1. Check ci ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> ### **After** <!-- [screenshots/recordings] --> ## **Pre-merge author checklist** - [x] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md). - [x] I've completed the PR template to the best of my ability - [x] I’ve included tests if applicable - [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.
<!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** Continuing the work of removing the e2e anti-pattern of finding the element and then asserting its text. There are more occurrences, but this work is split in several PRs, for an easy review and a faster ci. Once all occurrences have been fixed, we'll be able to merge @HowardBraham 's [PR ](#27591 adding a lint rule which prevents introducing it again. [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/28043?quickstart=1) ## **Related issues** Fixes: (but doesn't yet closes) #19870 ## **Manual testing steps** 1. Check ci ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> ### **After** <!-- [screenshots/recordings] --> ## **Pre-merge author checklist** - [x] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md). - [x] I've completed the PR template to the best of my ability - [x] I’ve included tests if applicable - [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.
<!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** Continuing the work of removing the e2e anti-pattern of finding the element and then asserting its text. There are more occurrences, but this work is split in several PRs, for an easy review and a faster ci. Once all occurrences have been fixed, we'll be able to merge @HowardBraham 's [PR ](#27591 adding a lint rule which prevents introducing it again. [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/28062?quickstart=1) ## **Related issues** Fixes: (but doesn't yet closes) #19870 ## **Manual testing steps** 1. Check ci ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> ### **After** <!-- [screenshots/recordings] --> ## **Pre-merge author checklist** - [x] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md). - [x] I've completed the PR template to the best of my ability - [x] I’ve included tests if applicable - [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.
<!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** Continuing the work of removing the e2e anti-pattern of finding the element and then asserting its text. There are more occurrences, but this work is split in several PRs, for an easy review and a faster ci. Once all occurrences have been fixed, we'll be able to merge @HowardBraham 's [PR ](#27591 adding a lint rule which prevents introducing it again. [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/28043?quickstart=1) ## **Related issues** Fixes: (but doesn't yet closes) #19870 ## **Manual testing steps** 1. Check ci ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> ### **After** <!-- [screenshots/recordings] --> ## **Pre-merge author checklist** - [x] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md). - [x] I've completed the PR template to the best of my ability - [x] I’ve included tests if applicable - [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.
<!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** Continuing the work of removing the e2e anti-pattern of finding the element and then asserting its text. There are more occurrences, but this work is split in several PRs, for an easy review and a faster ci. Once all occurrences have been fixed, we'll be able to merge @HowardBraham 's [PR ](#27591 adding a lint rule which prevents introducing it again. [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/28062?quickstart=1) ## **Related issues** Fixes: (but doesn't yet closes) #19870 ## **Manual testing steps** 1. Check ci ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> ### **After** <!-- [screenshots/recordings] --> ## **Pre-merge author checklist** - [x] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md). - [x] I've completed the PR template to the best of my ability - [x] I’ve included tests if applicable - [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.
Builds ready [5ca9d31]
Page Load Metrics (2038 ± 57 ms)
Bundle size diffs
|
Description
UPDATE October 23: this is ready for comments now, but not ready for merging, waiting on #28041, #28043, and probably more
Allows us to write custom ESLint rules directly in our repo, without using an external NPM package.
I evaluated several packages to do this, including:
eslint-plugin-rulesdir seemed the best for our purposes. I tried for several days to get this working with TypeScript rules, involving @davidmurdoch and @naugtur, but I think it's not going to play nice with LavaMoat. When we upgrade to ESLint 9, we can get rid of eslint-plugin-rulesdir, start using the special "local" plugin, and write TypeScript rules.
get-text-anti-pattern.js
serves as an example rule. It's something I've been thinking about for months, for how to combat this prevalent anti-pattern #19870.Related issues
Manual testing steps
Screenshots/Recordings
Pre-merge author checklist
Pre-merge reviewer checklist