From 3a33e21d78499ceeea440e25867ba029d222fb35 Mon Sep 17 00:00:00 2001 From: Elliot Winkler Date: Fri, 23 Oct 2026 13:25:29 -0600 Subject: [PATCH 1/3] Use Node16 for module + moduleResolution; support *.mts files 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. --- .depcheckrc.json | 3 ++- .eslintrc.js | 6 +++--- package.json | 2 +- src/{changelog-check.ts => changelog-check.mts} | 0 tsconfig.json | 5 +++-- 5 files changed, 9 insertions(+), 7 deletions(-) rename src/{changelog-check.ts => changelog-check.mts} (100%) diff --git a/.depcheckrc.json b/.depcheckrc.json index 28529cef..2d47463c 100644 --- a/.depcheckrc.json +++ b/.depcheckrc.json @@ -1,7 +1,8 @@ { "parsers": { "**/*.mjs": "es6", - "**/*.ts": "typescript" + "**/*.ts": "typescript", + "**/*.mts": "typescript" }, "ignores": [ "@lavamoat/allow-scripts", diff --git a/.eslintrc.js b/.eslintrc.js index c1cb4a1e..112e5826 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -5,12 +5,12 @@ module.exports = { overrides: [ { - files: ['*.ts'], + files: ['*.ts', '*.mts'], extends: ['@metamask/eslint-config-typescript'], }, { - files: ['*.js', '*.ts'], + files: ['*.js', '*.ts', '*.mts'], parserOptions: { sourceType: 'script', }, @@ -18,7 +18,7 @@ module.exports = { }, { - files: ['*.mjs'], + files: ['*.mjs', '*.mts'], parserOptions: { sourceType: 'module', ecmaVersion: 2022, diff --git a/package.json b/package.json index 130840f5..f8afa10d 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "url": "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/MetaMask/github-tools.git" }, "scripts": { - "changelog:check": "ts-node src/changelog-check.ts", + "changelog:check": "node --loader ts-node/esm src/changelog-check.mts", "count-references-to-contributor-docs": "ts-node --swc src/scripts/count-references-to-contributor-docs/cli.ts", "gen:commits": "node .github/scripts/generate-rc-commits.mjs", "get-review-metrics": "ts-node src/get-review-metrics.ts", diff --git a/src/changelog-check.ts b/src/changelog-check.mts similarity index 100% rename from src/changelog-check.ts rename to src/changelog-check.mts diff --git a/tsconfig.json b/tsconfig.json index a6ca900d..25251915 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -4,11 +4,12 @@ "exactOptionalPropertyTypes": true, "forceConsistentCasingInFileNames": true, "lib": ["ES2022"], - "module": "CommonJS", - "moduleResolution": "node", + "module": "Node16", + "moduleResolution": "Node16", "noEmit": true, "noErrorTruncation": true, "noUncheckedIndexedAccess": true, + "skipLibCheck": true, "strict": true, "target": "es2020" }, From a78baec7ccbc05cff3b52e39a9d62d0cfbbdbc48 Mon Sep 17 00:00:00 2001 From: Elliot Winkler Date: Fri, 23 Oct 2026 13:34:22 -0600 Subject: [PATCH 2/3] Update coverage thresholds --- jest.config.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/jest.config.js b/jest.config.js index 80e4ce81..9c906cdf 100644 --- a/jest.config.js +++ b/jest.config.js @@ -41,10 +41,10 @@ module.exports = { // An object that configures minimum threshold enforcement for coverage results coverageThreshold: { global: { - branches: 49.56, - functions: 55.62, - lines: 56.13, - statements: 56.19, + branches: 60.84, + functions: 62.25, + lines: 65.68, + statements: 65.84, }, }, From 2c231f1e3d309f1d0d21abff8c4033244fa3960c Mon Sep 17 00:00:00 2001 From: Elliot Winkler Date: Fri, 23 Oct 2026 13:44:29 -0600 Subject: [PATCH 3/3] Make sure ESLint sees .mts files --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f8afa10d..715f0a3e 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "lint:constraints": "yarn constraints", "lint:changelog": "auto-changelog validate --prettier", "lint:dependencies": "depcheck && yarn dedupe", - "lint:eslint": "eslint . --cache --ext js,ts && eslint --no-ignore --cache --ext mjs .github/actions/draft-segment-schema-pr", + "lint:eslint": "eslint . --cache --ext js,ts,mts && eslint --no-ignore --cache --ext mjs .github/actions/draft-segment-schema-pr", "lint:fix": "yarn lint:eslint --fix && yarn lint:constraints --fix && yarn lint:misc --write && yarn lint:dependencies", "lint:misc": "prettier '**/*.json' '**/*.md' '**/*.yml' '!.yarnrc.yml' '!.cursor/**' --ignore-path .gitignore --no-error-on-unmatched-pattern", "lint:tsc": "tsc",