metamask-extension icon indicating copy to clipboard operation
metamask-extension copied to clipboard

feat: allow custom ESLint rules and add get-text-anti-pattern

Open HowardBraham opened this issue 4 months ago • 3 comments

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.

Open in GitHub Codespaces

Related issues

Manual testing steps

Screenshots/Recordings

Pre-merge author checklist

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.

HowardBraham avatar Oct 03 '24 01:10 HowardBraham