Repository navigation
Use Node16 for module + moduleResolution; support *.mts files - #299
Conversation
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.
| }, | ||
| "scripts": { | ||
| "changelog:check": "ts-node src/changelog-check.ts", | ||
| "changelog:check": "node --loader ts-node/esm src/changelog-check.mts", |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Yes, it would be nice to drop ts-node. We dropped it in the Extension.
| functions: 55.62, | ||
| lines: 56.13, | ||
| statements: 56.19, | ||
| branches: 60.84, |
There was a problem hiding this comment.
I'm not sure why these went up 🤷🏻 But I'll take it!
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort 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 a78baec. Configure here.

We want to upgrade
@metamask/auto-changelog, but 7.0.0 of this package is ESM-only and exclusively exports types viaexports.exportsare not supported by TypeScript'snodemodule resolution strategy, so this commit updatestsconfig.jsonto useNode16instead.That change forced three other changes:
skipLibCheck, as@metamask/superstructstarts producing type errors otherwise.changelog-check.tstochangelog-check.mts, because TypeScript now seesexecaas an ESM-only module, and to be able import ESM-only modules, we need the file to be interpreted as ESM..mtsfiles.Manual testing steps
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:checkis launched as ESM.Overview
Switches TypeScript to
Node16formoduleandmoduleResolutionso dependencies that expose types only viapackage.jsonexports(e.g. future ESM-only@metamask/auto-changelog) resolve correctly.skipLibCheckis turned on to avoid new lib-check failures from@metamask/superstruct.The changelog validation entrypoint is moved to an ESM
.mtsfile andyarn changelog:checknow runs it withnode --loader ts-node/esminstead of plaints-node, so ESM-only imports likeexecatype-check under the new resolution. ESLint, depcheck, and thelint:eslintscript are extended to treat.mtslike 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.