chore: modernise tsconfig and required toolchain#126
Conversation
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
|
Warning MetaMask internal reviewing guidelines:
Ignoring alerts on:
|
Align tsconfig.json with the module template within the bounds of an Action-not-npm repo: add forceConsistentCasingInFileNames, exactOptionalPropertyTypes, noUncheckedIndexedAccess, noErrorTruncation; bump target to ES2020 and lib to ES2023; drop the redundant typeRoots. Skip noEmit and Node16 module resolution -- tsc still needs to emit lib/ for ncc to bundle, and switching to Node16 would require .js extensions on every relative import. Bump TypeScript to ~5.7.3 (template version) to unlock the new flags, which forces jest/ts-jest/@types/jest to 29.x because ts-jest 26 uses TS internals that were removed in TS 5. @types/node bumps to ^18.18 to fix a TS 5 type error in the bundled @types/node. Adjust the GITHUB_WORKSPACE restore in utils.test.ts to satisfy exactOptionalPropertyTypes and correctly delete the var when it wasn't set originally.
42aa499 to
4ff59fb
Compare
|
@SocketSecurity ignore npm/update-browserslist-db@1.2.3 Shell access seems fine. @SocketSecurity ignore npm/babel-plugin-istanbul@6.1.1 New author is ok. |
Summary
Aligns
tsconfig.jsonwith the MetaMask module template, with deliberate exceptions where this Action repo's build pipeline diverges from an npm module:tsconfig.jsonchangestargetES2019ES2020libES2020ES2023forceConsistentCasingInFileNamestrueexactOptionalPropertyTypestruenoUncheckedIndexedAccesstruenoErrorTruncationtruetypeRoots["node_modules/@types"]exclude["src/**/*.test.ts"]["./dist", "src/**/*.test.ts"]Intentionally not adopted from the template
noEmit: true—tschere actually emitslib/fornccto bundle intodist/. SettingnoEmit: truewould break the build chain.module: Node16/moduleResolution: Node16— would require adding.jsextensions to every relative import. No real benefit for an Action wherenccbundles everything into one file.Toolchain bumps (required to unlock the new flags)
typescript:^4.2.4→~5.7.3(template version).@types/node:^18.6.1→^18.18(TS 5 surfaces a typing bug in older@types/node@18.6).jest:^26.6.3→^29.7.0.ts-jest:^26.5.5→^29.1.0— ts-jest 26 uses TS internals (ts.getMutableClone) that were removed in TS 5.@types/jest:^26.0.22→^29.5.0.Source change
src/utils.test.tsadjusts theGITHUB_WORKSPACEenv-var restore inafterAllto satisfyexactOptionalPropertyTypesand to correctlydeletethe var when it wasn't set originally (the oldif ('GITHUB_WORKSPACE' in process.env)check was a no-op becausebeforeAllalways deletes it first).Part of an opportunistic module-template sync.