Add autofixing of lint warnings for specific packages/files
Explanation
Currently, there are a ton of lint warnings, and it would be good to address them sooner rather than later. To make PRs easier to approve, we could batch lint violation fixes by codeowner. That is, open PRs progressively by addressing all lint violations for packages owned by the Wallet Framework team first, then the Accounts team, then the Confirmations team, etc.
To do this, we need a way to run ESLint on specific directories. That's what this PR does. Now you can say, for example:
yarn lint:eslint packages/network-controller --fix
and now ESLint will run just on network-controller files, and autofix any warnings automatically.
One thing to keep in mind here is that we also want to keep the warning thresholds file up to date. This is a bit tricky because if we were to run
yarn lint:eslint packages/network-controller --quiet
then ESLint would only process lint errors and not warnings + errors. If this command is successful, i.e., there are no lint errors found, then we don't want the warning thresholds file to be blown away. So this commit also contains updates to the logic to ensure this doesn't happen.
Manual testing steps
As stated above, you should be able to run e.g.:
yarn lint:eslint packages/network-controller --fix
and see a bunch of changes made to network-controller files that fix lint violations. (ESLint may continue to report some errors as unfixable, but that's okay.)
References
Changelog
(N/A, developer-only change)
Checklist
- [x] I've updated the test suite for new or updated code as appropriate
- [x] I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
- [x] I've highlighted breaking changes using the "BREAKING" category above as appropriate
- [x] I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes
~Blocked by #5159.~ No longer blocked.