Skip to content

Use Node16 for module + moduleResolution; support *.mts files - #299

Merged
mcmire merged 3 commits into
mainfrom
use-node16-module-resolution
Oct 23, 2026
Merged

mcmire merged 3 commits into
mainfrom
use-node16-module-resolution

Conversation

@mcmire

@mcmire mcmire commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

We want to upgrade @metamask/auto-changelog, but 7.0.0 of this package is ESM-only and exclusively exports types via exports. exports are not supported by TypeScript's node module resolution strategy, so this commit updates tsconfig.json to use Node16 instead.

That change forced three other changes:

  • We've enabled skipLibCheck, as @metamask/superstruct starts producing type errors otherwise.
  • We've renamed changelog-check.ts to changelog-check.mts, because TypeScript now sees execa as an ESM-only module, and to be able import ESM-only modules, we need the file to be interpreted as ESM.
  • We've updated the ESLint and depcheck configurations to support .mts files.

Manual testing steps

  • Try running yarn changelog:check. It should not fail to run (although it will produce an error, because expected arguments are missing).

Note

Low Risk
Mostly compiler and lint/tooling config; the main runtime behavior change is how changelog:check is launched as ESM.

Overview
Switches TypeScript to Node16 for module and moduleResolution so dependencies that expose types only via package.json exports (e.g. future ESM-only @metamask/auto-changelog) resolve correctly. skipLibCheck is turned on to avoid new lib-check failures from @metamask/superstruct.

The changelog validation entrypoint is moved to an ESM .mts file and yarn changelog:check now runs it with node --loader ts-node/esm instead of plain ts-node, so ESM-only imports like execa type-check under the new resolution. ESLint, depcheck, and the lint:eslint script are extended to treat .mts like other TypeScript/module sources.

Jest global coverage thresholds are raised to match current measured coverage (typical jest-it-up outcome after tests).

Reviewed by Cursor Bugbot for commit 2c231f1. Bugbot is set up for automated code reviews on this repo. Configure here.

We want to upgrade `@metamask/auto-changelog`, but 7.0.0 is ESM-only
and exclusively exports types via `exports`. `exports` are not supported
by TypeScript's `node` module resolution strategy, so this commit
updates `tsconfig.json` to use `Node16` instead.

That change forced three other changes:

- We've enabled `skipLibCheck`, as `@metamask/superstruct` starts
  producing type errors otherwise.
- We've renamed `changelog-check.ts` to `changelog-check.mts`, because
  TypeScript now sees `execa` as an ESM-only module, and to be able
  import ESM-only modules, we need the file to be interpreted as ESM.
- We've updated the ESLint and depcheck configurations to support `.mts`
  files.
Comment thread package.json
},
"scripts": {
"changelog:check": "ts-node src/changelog-check.ts",
"changelog:check": "node --loader ts-node/esm src/changelog-check.mts",

@mcmire mcmire Oct 23, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This causes yarn changelog:check to produce a warning that --loader is experimental. It may or may not work in future versions of Node.

If we can upgrade Node then we may be able to take advantage of Node's type-stripping feature and then we can drop ts-node entirely:

    "changelog:check": "node src/changelog-check.mts",

But maybe this is okay for now?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it would be nice to drop ts-node. We dropped it in the Extension.

Comment thread jest.config.js
functions: 55.62,
lines: 56.13,
statements: 56.19,
branches: 60.84,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure why these went up 🤷🏻 But I'll take it!

@mcmire
mcmire marked this pull request as ready for review October 23, 2026 19:37

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ 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 a78baec. Configure here.

Comment thread package.json
@mcmire
mcmire merged commit 0cb4827 into main Oct 23, 2026
10 checks passed
@mcmire
mcmire deleted the use-node16-module-resolution branch October 23, 2026 20:00
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.

2 participants