chore: upgrade TypeScript to 5.5.4 and typescript-eslint v8 (zero runtime change) - #490
Conversation
Pin typescript at 5.5.4 (matches the backend monorepo compiler) and move the
tooling that peers on it: @typescript-eslint/{parser,eslint-plugin} 5.62 -> 8.69
(eslint floor raised to ^8.57.0, still eslintrc), ts-node ^10.9.2, ts-mocha
^10.1.0, prettier-plugin-organize-imports ^3.2.4. ts-jest and ts-mocha 11 are
deliberately not bumped further: both change yarn hoisting in a way that alters
the Lambda bundles (semver source-map paths; bunyan's optional require of
source-map-support), see the PR description.
TS 5.5.4 compiles both tsconfigs with zero source changes. .eslintrc maps the
removed ban-types rule and pins the v5 `recommended` severities so the lint
result is identical (87 warnings, 0 errors, same file:line/rule set).
tsconfig.cdk.json drops the non-existent `.env.js` files entry (already a hard
TS6053 error for tsc on main; ts-node ignores `files`) and gains skipLibCheck
to match tsconfig.json, so `tsc -p tsconfig.cdk.json` now passes.
Synthesized templates and all 8 Lambda asset hashes are byte-identical to main.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Pure specifier reordering inside existing import statements (TS 5's organizeImports sorts case-insensitively). No code change. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
|
Warning Review the following alerts detected in dependencies. According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.
|
…1, ts-jest 29.4.12; fix the two suppressed lint findings (#491) * build: externalize source-map-support from the Lambda bundles All nine NodejsFunctions now share LAMBDA_BUNDLING (minify + sourceMap as before) with externalModules: ['@aws-sdk/*', 'source-map-support']. The first entry restates CDK's default; the second stops bunyan's optional, undeclared require('source-map-support') from pulling whichever copy dev tooling happens to hoist into the production bundles. Nothing here uses it (no logger is created with src: true, and NODE_OPTIONS=--enable-source-maps already covers stack traces), and bunyan's try/catch handles the missing module. Effect: the 4 bundles that include bunyan (quote, hard-quote, fade-rate cron, redshift reaper) lose source-map-support, source-map and buffer-from (~35 KB each); the 4 analytics bundles are byte-identical. Asset hashes stop moving on unrelated dependency PRs. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * chore(deps): ts-mocha 10 -> 11.1.0, ts-jest 29.4.1 -> 29.4.12 Both were held back from #490 because they changed the Lambda bundles through yarn hoisting (ts-mocha 11 drops the nested ts-node 7 that supplied source-map-support 0.5.21; ts-jest 29.4.12 moves semver 7.8.5 to the top level). With source-map-support externalized that no longer matters. Integ tests now compile under the repo's ts-node 10.9.2 instead of ts-node 7.0.1. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(lint): resolve the two findings #490 had to suppress Remove the caughtErrors:"none" and no-duplicate-enum-values:"off" overrides added in #490 to keep the lint gate identical, and fix what they hid: - api-handler.ts: `catch (err)` with an unused binding -> `catch {}`. - analytics-stack.ts: drop the unused RS_DATA_TYPES.ALL_STATUS and BOT_EVENT_TYPE members that duplicated ORDER_TYPE's 'text' value (the only one referenced). Column types are unchanged, so the Analytics template is byte-identical. Lint stays at 87 warnings / 0 errors with the same file:line/rule set. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Summary
Upgrades the compiler from TypeScript 4.9.5 to 5.5.4 (exact pin), matching the backend monorepo this service is being prepared to migrate into, together with the dev tooling that peers on the TypeScript version. Zero runtime-behavior change: no source file under
lib/orbin/is touched, and the synthesized CloudFormation templates, including all 8 Lambda bundle asset hashes, are byte-identical tomain(method below).Package versions
typescript^4.8.4→ 4.9.55.5.4→ 5.5.4@typescript-eslint/parser^5.40.1→ 5.62.0^8.69.0→ 8.69.0typescript >=4.8.4 <6.1.0,eslint ^8.57.0 || ^9 || ^10@typescript-eslint/eslint-plugin^5.40.1→ 5.62.0^8.69.0→ 8.69.0eslint^8.26.0→ 8.57.1^8.57.0→ 8.57.1ts-node^10.9.1→ 10.9.2^10.9.2→ 10.9.2prettier-plugin-organize-imports^3.1.1→ 3.2.4^3.2.4→ 3.2.4ts-mocha^10.0.0→ 10.1.0^10.1.0→ 10.1.0ts-jest^29.0.3→ 29.4.1typescript >=4.3 <6; 29.4.12 evaluated and deliberately not taken, see "Why not further"prettier,@types/node,jest,@swc/jest,esbuild, everything elseyarn.lockchanges are confined to the packages above and their dev-only transitive closure (typescript-eslint v5 → v8 subtree:tsutils/tslib@1,globby,natural-compare-lite… out;ts-api-utils,tinyglobby,@typescript-eslint/project-service… in). No lockfile key changed its resolved version.Source changes the compiler forced
None. TypeScript 5.5.4 compiles both
tsconfig.json(yarn build) andtsconfig.cdk.jsonwith zero errors; no annotation, generic, or narrowing change was needed anywhere.The only file edits outside config are the 4 test files in the second commit (
style: ...), whereprettier-plugin-organize-importsrunning on TS 5.5'sorganizeImportssorts import specifiers case-insensitively (MOCK_FILLER_ADDRESSnow beforeMockQuoter,deployMarkersafterDASHBOARD_..., etc.). Pure specifier reordering within existing import statements; safe to skip in review.tsconfig
Neither tsconfig uses any option TS 5.x deprecates or rejects (
importsNotUsedAsValues,preserveValueImports,noImplicitUseStrict,suppressImplicitAnyIndexErrors,keyofStringsOnly,charset,out,noStrictGenericChecks,prepend,target: ES3— none present).moduleResolution: nodeand all strictness flags are left exactly as they were.tsconfig.cdk.json, two edits:"files": ["./.env.js"]. The file does not exist in the repo, andnpx tsc --noEmit -p tsconfig.cdk.jsonwas already a hard error onmainunder TS 4.9.5 (TS6053: File '.env.js' not found), so the CDK-side compile check in the verification list could not pass without this. ts-node (which is whatcdk synthandts-mochaactually use with this config) ignoresfiles/include/excludeby default, so synth and integ behavior are unaffected. With the entry gone,tsc -p tsconfig.cdk.jsonnow type-checks the whole repo undermodule: commonjs, which is what that check is for."skipLibCheck": true, mirroringtsconfig.json. Without it the CDK-side check fails only inside third-party.d.tsfiles (39 errors onmainwith TS 4.9.5 too:@types/mochavs@types/jestglobals,@smithy/corere-exports,aws-cdk-libexpectingIMixinfromconstructs ^10.5— the existing peer warning —, missing@types/async-retrybehindsmart-order-router). No effect on ts-node (per-file diagnostics) or on esbuild. This is the one tsconfig edit not strictly a deprecation fix; if you would rather not have it, drop it and run the check asnpx tsc --noEmit -p tsconfig.cdk.json --skipLibCheck.ESLint: preset/rule mapping (lint result identical)
.eslintrcstill extendseslint:recommended,plugin:@typescript-eslint/eslint-recommended,plugin:@typescript-eslint/recommended(all still exist in v8; no rename). The custom rules, including the threeno-restricted-syntaxselectors banning.only/fit/fdescribeand nestedit(), are untouched. What v8 changed, and how it is mapped so the lint gate does not move:.eslintrcban-types: warnno-unsafe-function-type: warn,no-wrapper-object-types: warn,no-empty-object-type: ["warn", { allowInterfaces: "always" }](repo hasno-empty-interface: off, so interfaces stay allowed)no-explicit-any: warn(recommended)errorwarnno-non-null-assertion: warn(recommended)strictwarnadjacent-overload-signatures,no-empty-function,no-inferrable-types: error(recommended)stylisticerrorno-unused-varsdefaultcaughtErrors: "none""all"caughtErrors: "none"to the existing["warn", { argsIgnorePattern: "^_" }](otherwise 1 new warning: unusederrinlib/handlers/base/api-handler.ts:310)no-duplicate-enum-values: erroroff— its only hits areRedshiftColumnTypeinbin/stacks/analytics-stack.ts:34-35, whereALL_STATUS/BOT_EVENT_TYPE/ORDER_TYPEintentionally share'text'; see findingsno-extra-semi,no-loss-of-precision(TS versions)eslint:recommendedon ESLint 8no-var-requiresno-require-imports(v8 recommended)Other v8-only recommended rules (
no-unused-expressions,no-unsafe-declaration-merging,no-require-imports) are left on; they report nothing in this repo.Result:
yarn lintbefore and after:✖ 87 problems (0 errors, 87 warnings), and the normalizedfile:line severity rulelist is identical (64no-explicit-any, 14no-non-null-assertion, 8no-unused-vars, 1no-unsafe-function-type(wasban-types)). Prettier--checkclean. No neweslint-disable,@ts-ignore,@ts-expect-error, oranycasts.Why not further: ts-mocha 11 and ts-jest 29.4.12
Both were tried and both change what gets deployed, even though neither is a runtime dependency:
ts-node@7.0.1in favour of the repo's ts-node 10. That removessource-map-support@0.5.21from the tree.bunyan(a runtime dependency) does an optional, undeclaredrequire('source-map-support'), and esbuild bundles whatever version is hoisted, so the 4 Lambda bundles that include bunyan (quote handler, hard-quote handler, two cron lambdas) would silently switch from source-map-support 0.5.21 to 0.5.13.semver ^7.8.5(29.4.1 requests^7.7.2). Together with typescript-eslint v8's^7.7.3, that makes yarn hoistsemver@7.8.5to the top level and nest7.7.2under@eth-optimism/sdk. The bundled code is byte-identical, but the Lambda source maps record the new path, so 3 asset hashes (and theirAWS::Lambda::Versionlogical IDs) change, which would redeploy identical code to prod.With ts-mocha on 10.x and ts-jest unchanged, everything is identical. Both bumps are ready to take once the phantom
source-map-supportdependency is made explicit (finding 1). ts-mocha 10 → ts-node 7.0.1 → TS 5.5.4 was checked:ts-mocha -p tsconfig.cdk.json --dry-run test/integ/**/*.test.tscompiles the integ suite and stops at the sameCOSIGNER_ADDRenv check as onmain.Findings (preserved as-is, for separate PRs)
bunyanoptionally requiressource-map-support, which this repo never declares. Which version ends up inside the prod Lambda bundles is decided by yarn hoisting of dev tooling (today: 0.5.21 via ts-mocha 10 → ts-node 7). Suggest declaringsource-map-support(pinned to0.5.21to keep the bundle identical), then taking ts-mocha 11 / ts-jest 29.4.12.RedshiftColumnTypeduplicate enum values (bin/stacks/analytics-stack.ts:30-35):ALL_STATUS,BOT_EVENT_TYPE,ORDER_TYPEall equal'text'. Looks intentional (semantic aliases for the same SQL type), butno-duplicate-enum-valueswould flag it; rule leftoffhere, decide separately.catch (err)atlib/handlers/base/api-handler.ts:310; harmless, surfaced only by v8's newcaughtErrorsdefault.tsc -p tsconfig.cdk.jsonnever compiled onmain(missing.env.jsinfiles, and 39 third-party.d.tserrors withoutskipLibCheck). Fixed here as described above; nothing depended on it because ts-node ignoresfiles.Verification
Run from a clean
yarn install --frozen-lockfileof this branch (Node 22.21.0, yarn 1.22.22, Java 1.8 available forjest-dynamodb):yarn install --frozen-lockfile && yarn buildnpx tsc --noEmit -p tsconfig.cdk.jsonmain, see above)yarn test:unit.snapfile modifiedtest/handlers/*/response-surface.test.ts.snapfiles unmodifiedyarn lintfile:line/rule/severityset tomain; prettier cleannpx cdk synthvsmain*.template.json(root, pipeline, 2 nested, beta/prod assembly sets) byte-identical; 8/8 Lambdaasset.*hashes identicalSynth comparison method (the naive comparison is misleading, see below):
mainand this branch each checked out in agit worktree, each with its own cleanyarn install --frozen-lockfile, identical already-convergedcdk.context.json,cdk synthrun twice per side (run 1 == run 2 on both), thenmd5over every*.template.jsonand over theasset.*directory names. A first attempt that reused the main checkout's long-livednode_modulesfor the baseline produced spurious asset-hash differences (its physical layout differs from a clean install: nestedrouter-sdkcopies, stalebufferutil/utf-8-validate), which is why the baseline was rebuilt from a clean install.Not run:
yarn test:integ(needs the integ env /COSIGNER_ADDR); compile of the integ suite under the new toolchain was verified with--dry-runas noted above.