metamask-extension
metamask-extension copied to clipboard
feat: allow custom ESLint rules and add get-text-anti-pattern
Description
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:
- https://www.npmjs.com/package/eslint-plugin-local-rules
- https://www.npmjs.com/package/eslint-plugin-rulesdir
- https://www.npmjs.com/package/eslint-plugin-local
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. I don't think this rule is quite good enough yet.
Related issues
Manual testing steps
Screenshots/Recordings
Pre-merge author checklist
- [x] I've followed MetaMask Contributor Docs and MetaMask Extension Coding Standards.
- [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 format if applicable
- [x] I’ve applied the right labels on the PR (see labeling guidelines). 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.