chore: align @metamask/utils deps and scripts with the monorepo - #10181
Merged
cryptodev-2s merged 1 commit intoSep 11, 2026
Merged
Conversation
cryptodev-2s
added this pull request to stack #10183
September 10, 2026 18:32
This was referenced Sep 10, 2026
cryptodev-2s
marked this pull request as ready for review
September 10, 2026 20:44
cryptodev-2s
force-pushed
the
chore/utils-align-deps-scripts
branch
from
September 10, 2026 21:34
c9e4974 to
03ad866
Compare
cryptodev-2s
force-pushed
the
chore/utils-align-deps-scripts
branch
from
September 11, 2026 06:49
03ad866 to
801283a
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 801283a. Configure here.
| "test:clean": "NODE_OPTIONS=--experimental-vm-modules jest --clearCache", | ||
| "test:types": "tsd --files 'src/*.test-d.ts'", | ||
| "test:watch": "jest --watch" | ||
| "test:verbose": "NODE_OPTIONS=--experimental-vm-modules jest --verbose", |
There was a problem hiding this comment.
Type tests skipped in monorepo runs
Medium Severity
Packages that define test:types split Jest into test:unit variants so test, test:clean, and test:verbose all run type tests. These scripts only append test:types to test, so the monorepo test:verbose entrypoint skips the tsd checks.
Reviewed by Cursor Bugbot for commit 801283a. Configure here.
cryptodev-2s
force-pushed
the
chore/utils-align-deps-scripts
branch
from
September 11, 2026 07:02
801283a to
5519d15
Compare
cryptodev-2s
force-pushed
the
chore/utils-align-deps-scripts
branch
from
September 11, 2026 07:09
5519d15 to
6489dce
Compare
GuillaumeRx
approved these changes
Sep 11, 2026
pull Bot
pushed a commit
to Reality2byte/core
that referenced
this pull request
Sep 11, 2026
…#10182) ## Explanation Final step of Phase B for `@metamask/utils` (PR#11 of the [migration process guide](https://github.com/MetaMask/core/blob/main/docs/processes/package-migration-process-guide.md)). The README is rewritten for its new status as a non-root package. The opening description is preserved, `Installation` is kept, and a `Contributing` section pointing at the monorepo README is added, matching the 95 packages with `Installation` and 94 with `Contributing`. Removed: the migration notice banner (no longer accurate now that the package lives here), and the development instructions the monorepo owns centrally, covering setup, testing, linting, documentation, the release process and preview builds. The `API` section is also dropped. It linked to `metamask.github.io/utils`, which will no longer be updated now that docs are generated from this repo. ## References - Follows MetaMask#10181 ## Checklist - [ ] 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 - [ ] I've communicated my changes to consumers by [updating changelogs for packages I've changed](https://github.com/MetaMask/core/tree/main/docs/processes/updating-changelogs.md) - [ ] I've introduced [breaking changes](https://github.com/MetaMask/core/tree/main/docs/processes/breaking-changes.md) in this PR and have prepared draft pull requests for clients and consumer packages to resolve them <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Documentation-only README edits with no runtime or API changes. > > **Overview** > Rewrites the **`@metamask/utils` README** now that the package lives in the **MetaMask core monorepo**, instead of the old standalone repo. > > The **migration warning banner** and long **local dev docs** (setup, test/lint, docs generation, release, preview builds) are removed in favor of a short **Contributing** section that points to the [monorepo README](https://github.com/MetaMask/core#readme). The **API** section linking to `metamask.github.io/utils` is removed because docs will come from this repo. The **package description** and **Installation** (`yarn` / `npm`) sections are unchanged; the title is updated to **`# @metamask/utils`**. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit b405a75. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->
pull Bot
pushed a commit
to Reality2byte/core
that referenced
this pull request
Sep 11, 2026
## Explanation Phase C of migrating `@metamask/utils`, following [the package migration process guide](https://github.com/MetaMask/core/blob/main/docs/processes/package-migration-process-guide.md). This moves the package from `merged-packages/` into `packages/` and wires it into the monorepo. - `merged-packages/utils` → `packages/utils`, registered as a workspace - Reference paths added to the root `tsconfig.json`, `tsconfig.build.json` and `tsconfig.lint.json` - The version bump for dependents is split into a follow up (MetaMask#10192) to keep this diff reviewable. This PR adds a temporary `@metamask/utils` entry to `ALLOWED_INCONSISTENT_DEPENDENCIES` in `yarn.config.cjs` so constraints pass while dependents are still on the published version; MetaMask#10192 removes it. The two are meant to land together. - Downstream tsconfig references added via `yarn lint:tsconfigs:fix:all` (174 files). Without them `yarn lint:tsc` reported 536 errors; it is now clean - `yarn constraints --fix` applied, which split the test scripts into `test:unit` and `test:types` - CODEOWNERS entry added through `codeowners.ts` and `teams.json`, assigning the package to `@MetaMask/core-platform` as with the other foundational packages - README package list and dependency graph regenerated with `yarn readme-content:update` ### Type tests moved from `tsd` to `tstyche` The package's type tests import from source (`./index.js`, `./misc.js`), so they never needed built declarations. `tsd` requires a typings file as a structural precondition regardless, which forced a build purely to satisfy the tool. `tstyche` type checks source directly and is already used by `@metamask/messenger`, so the four `*.test-d.ts` files are now `*.tst.ts`, with all 120 assertions preserved. That removed three workarounds: a `composite: false` override for `tsd`, a `--typings` flag, and the `*.test-d.ts` exclusion in `tsconfig.lint.json`. That last one existed because `tsd`'s own types pull in `lib="esnext"`, widening built in types like `ReadonlySet` past this package's target. With that gone the type tests are covered by `lint:tsc` rather than excluded from it, and `tsd` leaves the lockfile entirely. ### Root tooling now resolves the package from source Nine files at the repository root import `@metamask/utils`, which previously arrived prebuilt from npm. As a workspace its `dist` does not exist until something builds it, and the lint jobs do not build, so `constraints`, `lint:teams` and `lint:tsconfigs:all` all failed on a fresh checkout. Adding a `paths` entry to the root `tsconfig.json` fixes the scripts. `yarn.config.cjs` is the exception, since Yarn loads it as plain CommonJS where `paths` do not apply and a `.ts` file cannot be required. It only used `hasProperty`, whose runtime body is a single expression, so it now calls `Object.hasOwn` directly. That is available on every supported Node version. All of the following pass with no build artifacts present: `constraints`, `lint:teams`, `lint:tsconfigs:all`, `readme-content:check`, `codeowners:check`, `lint:tsc`, `lint:misc:check`, and the package's own tests. ### Inherited lint findings 86 pre-existing findings in the package, mostly `no-explicit-any` in tests, are recorded in `eslint-suppressions.json` rather than fixed here, matching how this repo tracks that debt. They came from rules the package's own ESLint config had disabled before the migration. ## References - Follows MetaMask#10175, MetaMask#10178, MetaMask#10179, MetaMask#10180, MetaMask#10181 and MetaMask#10182 - Migration process guide: `docs/processes/package-migration-process-guide.md` ## 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 - [ ] I've communicated my changes to consumers by [updating changelogs for packages I've changed](https://github.com/MetaMask/core/tree/main/docs/processes/updating-changelogs.md) - [ ] I've introduced [breaking changes](https://github.com/MetaMask/core/tree/main/docs/processes/breaking-changes.md) in this PR and have prepared draft pull requests for clients and consumer packages to resolve them <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Wide monorepo integration touches build graphs and resolution for a foundational dependency; temporary dual resolution (workspace v12 vs published v11) must land with the follow-up bump to avoid inconsistent runtime/types. > > **Overview** > **`@metamask/utils` is now a workspace package at `packages/utils` (v12.0.0)** instead of living under `merged-packages/` or npm-only. Repo metadata, CODEOWNERS/`teams.json`, README list/graph, and root `tsconfig` project references are updated so the package builds and lints with the rest of core. > > **Monorepo wiring:** Jest and root/script `tsconfig` paths resolve `@metamask/utils` (and `/node`) to **TypeScript source** so tests and lint work without a prior build. Package `tsconfig` references to `../utils` were added across dependents. **`tsconfig.packages.json` still maps `@metamask/utils` to published v11 in `node_modules`** until a follow-up bumps dependents; `yarn.config.cjs` temporarily allows that version skew and drops the `@metamask/utils` import in favor of **`Object.hasOwn`**. > > **Package tooling:** Type tests move from **`tsd` (`*.test-d.ts`) to `tstyche` (`*.tst.ts`)**; build excludes `*.tst.ts`. Unused **`@metamask/utils` dependencies are removed** from a few packages (e.g. messenger, ai-controllers). Pre-existing ESLint issues in `packages/utils` are **recorded in `eslint-suppressions.json`**. Stale **`merged-packages/utils`** type-test and lint config files are removed. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit dd04556. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Explanation
Fifth step of migrating
@metamask/utils(PR#10 of Phase B in the migration process guide).Scripts now match the other packages:
build:all,changelog:update,changelog:validate,lint:tsconfigs,since-latest-release, and theNODE_OPTIONS=--experimental-vm-modulestest variants. The lint scripts (lint,lint:eslint,lint:constraints,lint:misc,lint:dependencies,lint:tsc) are gone because the root owns linting, andprepackis gone with thescripts/directory removed in #10179.testkeeps runningtest:typesafter Jest, since this package hastsdtype tests that nothing else would run.Dependencies: 21 devDependencies drop to 17. Removed are the ones the root already provides and no package declares for itself: the
@lavamoat/*,@metamask/eslint-config*andeslint*sets, plus@types/node,@types/semver,knip,oxfmt,prettierandtypescript-eslint. Every one was already at a version identical to the root's, so nothing changes on disk.jest-it-upis also removed: it existed only to bump coverage thresholds from the oldtest:sourcescript, which no longer exists.Kept, matching the convention in all 99 packages:
typescript,@typescript/native,deepmerge,jest,ts-jest,rimraf,typedoc,@metamask/auto-changelog,@types/jest, andtsxfor the newlint:tsconfigsscript. Kept as genuinely package specific:jest-when,@types/jest-when,@types/uuid,stdio-mock,tsdandweb3. I verified each of those is actually imported by the sources.packageManageris dropped because no package declares it (the root does).enginesstays, as it does in all 99. Thelavamoatblock stays: 8 packages have one, including the sameunrs-resolverentry.Runtime dependencies are untouched.
References
@metamask/utilsconfigs from the monorepo root #10180Checklist
Note
Low Risk
Package metadata and tooling only; runtime dependencies and library code are untouched.
Overview
Aligns
@metamask/utilspackage.jsonwith the rest of the monorepo as part of the utils migration—no runtime dependency changes.Scripts now follow the shared pattern:
build:all, rootchangelog:*,lint:tsconfigs,since-latest-release, and Jest runs withNODE_OPTIONS=--experimental-vm-modulesplustest:clean/test:verbose. Package-local lint, prepack, andtest:source+jest-it-upare removed so the root owns linting and coverage bumping.teststill chainstest:types(tsd) after Jest.DevDependencies drop duplicate tooling the root already provides (ESLint/LavaMoat stacks,
knip,oxfmt,prettier, etc.) and addtsx(for tsconfig lint) andtypedoc-plugin-missing-exports.packageManageris removed (declared at the root);enginesandlavamoatstay unchanged.Reviewed by Cursor Bugbot for commit 6489dce. Bugbot is set up for automated code reviews on this repo. Configure here.