Skip to content

Conversation

@Mrtenz
Copy link
Member

@Mrtenz Mrtenz commented Feb 18, 2025

Feature branch for the ESLint 9 migration.

Closes #3097.

This bumps ESLint, the various ESLint configs, and related packages
(Prettier, etc.) to a more recent version, matching the MetaMask ESLint
configurations.

This is the first step in the ESLint 9 migration, and does not yet fix
any of the breaking changes. CI will not pass, but I will merge this
into a feature branch and follow up with other PRs.

Closes #3098.
This updates the LavaMoat build policy, following the dependency changes
in #3096.
This updates the CLI and Webpack plugin to handle breaking changes
following the bump required for ESLint 9.

Unfortunately Prettier 3 makes it very complicated to load configuration
files with CJS, since it loads the ESM bundle using a top-level await,
which is not supported by Node.js without additional experimental
parameters. For now I've removed the functionality for custom Prettier
configs, but we can reconsider this in the future (i.e., through
specifying a Prettier path in the CLI config, or allowing to provide the
options directly).
This updates the lint workflow for ESLint 9. It seems easier/faster to
run ESLint from the root, so I changed the lint job to only run once,
rather than for every package.
This rewrites the existing ESLint config to the flat config format, with
minimal modifications to the original config, other than those required
by the new format.

In addition to that, there are some other minor changes:

- I updated the Prettier config to use Prettier 3.
- I removed ESLint and related dependencies from all non-root workspace
packages. These are no longer required, and removing them makes
dependency maintenance a bit easier.

Closes #3099.
This either replaces or removes inline comments disabling ESLint rules
following the configuration changes in #3107 and rule changes in
`@metamask/eslint-config`.
This fixes all lint violations of the `import-x/order` rule.
This fixes lint violations caused by the `prettier/prettier` rule.

This PR does not contain any functional changes, only formatting
changes.
This fixes (most of) the remaining import rule violations:

- import-x/no-named-as-default-member
- import-x/no-duplicates
- import-x/extensions
- import-x/unambiguous
- import-x/no-unresolved
- import-x/no-nodejs-modules
- import-x/namespace
This fixes the following lint rule violations:

- @typescript-eslint/no-unused-vars
- @typescript-eslint/prefer-nullish-coalescing
- @typescript-eslint/switch-exhaustiveness-check
- @typescript-eslint/no-base-to-string
- @typescript-eslint/prefer-promise-reject-errors
- @typescript-eslint/prefer-readonly
- @typescript-eslint/no-floating-promises
- @typescript-eslint/no-misused-promises
- @typescript-eslint/await-thenable
- @typescript-eslint/restrict-template-expressions
- @typescript-eslint/unbound-method
- @typescript-eslint/no-empty-object-type
This updates the ESLint configuration to fix errors related to Node.js
and browser globals, and disables some rules that were too strict.
This fixes all violations of the `no-constant-binary-expression` by
ignoring them. We are using a constant binary expression on purpose in
these cases.
This fixes lint violations for the following rules:

- jest/no-disabled-tests
- jest/prefer-to-be
- jest/prefer-to-have-length
This fixes the following lint violations:

- jsdoc/check-param-names
- jsdoc/tag-lines
This fixes lint violations caused by the `no-restricted-syntax` rule by
suppressing these errors. We need to do additional research whether
these can be fixed, as some may be used by tests.
@socket-security
Copy link

socket-security bot commented Feb 19, 2025

New, updated, and removed dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/@es-joy/[email protected] 🔁 npm/@es-joy/[email protected], npm/@es-joy/[email protected] None 0 121 kB brettz9
npm/@eslint-community/[email protected] None 0 378 kB eslint-community-bot
npm/@eslint-community/[email protected] None 0 473 kB eslint-community-bot
npm/@eslint/[email protected] None 0 315 kB eslintbot, openjsfoundation
npm/@eslint/[email protected] None 0 64.6 kB eslintbot
npm/@eslint/[email protected] 🔁 npm/@eslint/[email protected] None +3 1.28 MB eslintbot
npm/@eslint/[email protected] None 0 14.9 kB eslintbot, openjsfoundation
npm/@eslint/[email protected] None 0 57 kB eslintbot, openjsfoundation
npm/@eslint/[email protected] None +1 137 kB eslintbot
npm/@humanfs/[email protected] None 0 72.7 kB nzakas
npm/@humanfs/[email protected] None +1 89.5 kB nzakas
npm/@humanwhocodes/[email protected] None 0 64.9 kB nzakas
npm/@jridgewell/[email protected] 🔁 npm/@jridgewell/[email protected] None 0 53.2 kB jridgewell
npm/@metamask/[email protected] 🔁 npm/@metamask/[email protected], npm/@metamask/[email protected] None 0 219 kB metamaskbot
npm/@metamask/[email protected] 🔁 npm/@metamask/[email protected] Transitive: environment +5 443 kB metamaskbot
npm/@metamask/[email protected] 🔁 npm/@metamask/[email protected] unsafe 0 8.7 kB metamaskbot
npm/@metamask/[email protected] 🔁 npm/@metamask/[email protected] None 0 12.2 kB metamaskbot
npm/@metamask/[email protected] 🔁 npm/@metamask/[email protected] unsafe 0 98.4 kB metamaskbot
npm/@metamask/[email protected] 🔁 npm/@metamask/[email protected] None 0 22.7 kB metamaskbot
npm/@metamask/[email protected] 🔁 npm/@metamask/[email protected], npm/@metamask/[email protected] unsafe 0 130 kB metamaskbot
npm/@nolyfill/[email protected] unsafe 0 2.71 kB sukkaw
npm/@types/[email protected] None 0 8.49 kB types
npm/@types/[email protected] 🔁 npm/@types/[email protected] None 0 31.7 kB types
npm/@typescript-eslint/[email protected] 🔁 npm/@typescript-eslint/[email protected] None 0 2.86 MB bradzacher, jameshenry
npm/@typescript-eslint/[email protected] 🔁 npm/@typescript-eslint/[email protected] None 0 19 kB bradzacher, jameshenry
npm/@typescript-eslint/[email protected] 🔁 npm/@typescript-eslint/[email protected], npm/@typescript-eslint/[email protected] None 0 624 kB bradzacher, jameshenry
npm/@typescript-eslint/[email protected] 🔁 npm/@typescript-eslint/[email protected] None 0 126 kB bradzacher, jameshenry
npm/@typescript-eslint/[email protected] 🔁 npm/@typescript-eslint/[email protected], npm/@typescript-eslint/[email protected] None 0 175 kB bradzacher, jameshenry
npm/@typescript-eslint/[email protected] 🔁 npm/@typescript-eslint/[email protected], npm/@typescript-eslint/[email protected] None 0 593 kB bradzacher, jameshenry
npm/@typescript-eslint/[email protected] 🔁 npm/@typescript-eslint/[email protected] None 0 283 kB bradzacher, jameshenry
npm/@typescript-eslint/[email protected] 🔁 npm/@typescript-eslint/[email protected], npm/@typescript-eslint/[email protected] None 0 19.4 kB bradzacher, jameshenry
npm/[email protected] 🔁 npm/[email protected] None 0 366 kB yavorskiys
npm/[email protected] 🔁 npm/[email protected] None +2 37 kB satazor
npm/[email protected] filesystem 0 53.1 kB ota-meshi
npm/[email protected] 🔁 npm/[email protected] None 0 20.8 kB lydell
npm/[email protected] 🔁 npm/[email protected] Transitive: environment +1 58.5 kB ljharb
npm/[email protected] None 0 52.6 kB jounqin
npm/[email protected] None 0 409 kB eslint-community-bot
npm/[email protected] None 0 699 kB jounqin
npm/[email protected] 🔁 npm/[email protected] None 0 350 kB aaronabramov, jeysal, jsonp, ...6 more
npm/[email protected] 🔁 npm/[email protected], npm/[email protected] filesystem +1 2.1 MB gajus
npm/[email protected] 🔁 npm/[email protected] None 0 461 kB weiran.zsd
npm/[email protected] 🔁 npm/[email protected] None 0 34.5 kB bpscott, jounqin, lydell, ...3 more
npm/[email protected] 🔁 npm/[email protected] None 0 96.6 kB eslint-community-bot
npm/[email protected] 🔁 npm/[email protected] None 0 152 kB eslintbot
npm/[email protected] 🔁 npm/[email protected] None +2 3.43 MB eslintbot, openjsfoundation
npm/[email protected] 🔁 npm/[email protected] None 0 98.4 kB mrmlnc
npm/[email protected] filesystem 0 45.2 kB thecodrr
npm/[email protected] 🔁 npm/[email protected] None 0 16 kB jaredwray
npm/[email protected] 🔁 npm/[email protected] None 0 29.3 kB jaredwray
npm/[email protected] 🔁 npm/[email protected] None 0 33.5 kB webreflection
npm/[email protected] 🔁 npm/[email protected] None 0 116 kB hirokiosame
npm/[email protected] 🔁 npm/[email protected] None 0 177 kB sindresorhus
npm/[email protected] None 0 812 kB mattpauldavies
npm/[email protected] 🔁 npm/[email protected] None 0 53.6 kB kael
npm/[email protected] None 0 11.8 kB sunset_techuila
npm/[email protected] 🔁 npm/[email protected] None 0 33.5 kB ljharb
npm/[email protected] 🔁 npm/[email protected], npm/[email protected] None 0 245 kB jsdoc-type-pratt-parser
npm/[email protected] 🔁 npm/[email protected] None 0 50.2 kB gkz
npm/[email protected] None 0 39.1 kB tomeraberbach
npm/[email protected] 🔁 npm/[email protected] None 0 5.55 kB matzkoh
npm/[email protected] None 0 7.88 MB prettier-bot
npm/[email protected] None 0 26 kB chrisackerman
npm/[email protected] 🔁 npm/[email protected] None +1 136 kB keithamus
npm/[email protected] None 0 5.46 kB quietshu
npm/[email protected] 🔁 npm/[email protected] None 0 59.8 kB jounqin
npm/[email protected] None 0 24.4 kB superchupu
npm/[email protected] 🔁 npm/[email protected] None 0 354 kB joshuakgoldberg
npm/[email protected] None 0 103 kB jameshenry
npm/[email protected] 🔁 npm/[email protected] None 0 11.8 kB jonschlinkert

🚮 Removed packages: npm/@humanwhocodes/[email protected], npm/@humanwhocodes/[email protected], npm/@jridgewell/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected]

View full report↗︎

This fixes a couple of minor issues after rebasing the `eslint-9`
branch.
This fixes some tests that are failing after ESLint 9 changes, and
updates example shasums.
@Mrtenz Mrtenz marked this pull request as ready for review February 19, 2025 09:29
@Mrtenz Mrtenz requested a review from a team as a code owner February 19, 2025 09:29
@codecov
Copy link

codecov bot commented Feb 19, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.90%. Comparing base (d736d82) to head (79f437b).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3118   +/-   ##
=======================================
  Coverage   94.90%   94.90%           
=======================================
  Files         506      504    -2     
  Lines       11119    11119           
  Branches     1709     1708    -1     
=======================================
+ Hits        10552    10553    +1     
+ Misses        567      566    -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Mrtenz Mrtenz merged commit 27f1def into main Feb 19, 2025
121 checks passed
@Mrtenz Mrtenz deleted the eslint-9 branch February 19, 2025 09:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migrate to ESLint 9

3 participants