chore(deps): pin typescript to 6.0.3 so the lint toolchain runs again - #150
Conversation
ESLint has been crashing at plugin load since the TS7-native migration:
TypeError: Cannot read properties of undefined (reading 'FunctionType')
at eslint-plugin-sonarjs/cjs/S2201/rule.js:244 (ts.SyntaxKind.FunctionType)
Root cause: TypeScript 7 is the native (Go) rewrite, and its root package export
dropped the classic JS API — `SyntaxKind`, `readConfigFile`, `createProgram`, …
moved under `typescript/unstable/*`. Classic-API consumers in the lint toolchain
(eslint-plugin-sonarjs, ts-api-utils, the @typescript-eslint/* chain) read that
API eagerly and blow up on the 7.0 export.
The catalog change alone doesn't fix it: the catalog governs only our workspace
packages, while those third-party tools range-depend on `typescript` and
independently resolve the highest published — 7.0. A global `overrides` pin is
what actually collapses the graph onto one compiler.
TypeScript 6.0 is the last classic-codebase release and carries the full API, so
pinning it keeps every consumer — build, typecheck, AND lint — on one working
compiler. The packem/oxc dts build is unaffected: it uses oxc's own isolated
declarations, not tsgo, so it never needed the 7.0 root in the first place.
Verified on 6.0.3: build 47/47, lint:types 59/59, test 48/48, and `eslint .`
runs (sonarjs resolves typescript@6.0.3 with SyntaxKind present).
See typescript-eslint#10940 — native tsgo support in typescript-eslint is 1–2
majors out, so classic TS is the supported path for typed linting today.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0197KjhmBDB3PXAc6TXiPqZ9
✅ Deploy Preview for lunorash ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Thank you for following the naming conventions! 🙏 |
|
Warning Review limit reached
Next review available in: 32 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (4)
📒 Files selected for processing (2)
WalkthroughThe PR aligns logger interfaces and shared type exports, clarifies structured logging documentation, relocates a formatter import, and adds lint suppressions or inferred type declarations across several packages. ChangesLogging and cross-package alignment
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Thank you for confirming the Contributor License Agreement! 🙏 |
Merging this PR will regress 1 benchmark
|
| Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|
| ❌ | 1 after-insert no-op trigger |
393.7 µs | 448.9 µs | -12.28% |
| ⚡ | in-batch: single IN(...) query + id->doc re-projection |
949.2 µs | 781.4 µs | +21.47% |
Tip
Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.
Comparing chore/typescript-6-lint-toolchain (107d6e3) with alpha (716c1cd)2
Footnotes
-
1 benchmark was skipped, so the baseline result was used instead. If it was deleted from the codebase, click here and archive it to remove it from the performance reports. ↩
-
No successful run was found on
alpha(2737573) during the generation of this report, so 716c1cd was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩
Mechanical autofixes (import ordering, prefer-export-from, exports grouping) surfaced once the linter could run again. Manual residual fixes follow. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0197KjhmBDB3PXAc6TXiPqZ9
With ESLint runnable again on TS6, ~66 errors surfaced across the repo —
accumulated while the linter was crashing since the TS7 migration. All fixed to
zero errors (the CI lint gate); warnings are non-blocking and follow separately.
Following the repo's established conventions:
- import/exports-last on data+types modules (errors/catalog, x402/networks,
nuxt/module): file-level disable with rationale, matching db/define-mutators
and server/data-model.
- no-void + sonarjs/void-use on the standalone `void (X satisfies Y)` shape
(an inline `as const satisfies` breaks isolatedDeclarations, TS9010): line/file
disable. The two test-file `void x.push()` uses became block bodies instead.
- no-secrets false-positive on a CamelCase type name in a doc comment: file-level
disable (the reason text deliberately omits the flagged token).
- unicorn/no-immediate-mutation: folded the first unconditional Map entry into the
constructor.
- @typescript-eslint/no-unsafe-assignment: annotated `Object.getPrototypeOf`'s
`any` result as `unknown` (the `===` checks still hold).
- sonarjs/different-types-comparison: a test's `context !== null` was statically
always-true (type is `LogSinkContext | undefined`); switched to the meaningful
`!== undefined`.
- jsdoc fixes: `{@link transform}` (a sibling property, not a type) → code span;
de-wrapped an indented list continuation.
Verified: 0 eslint errors, lint:types 59/59, and runtime/do/errors/server suites
green.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0197KjhmBDB3PXAc6TXiPqZ9
|
React Doctor found no new issues. 🎉 Reviewed by React Doctor for commit |
Three CI jobs went red after the autofix commit; all repaired: - **tests**: `prefer-strict-boolean-matchers` auto-converted a studio test's `expect(getByTestId(...)).toBeTruthy()` to `.toBe(true)` — but a DOM element is truthy, not `=== true`, so the assertion failed. Reverted to `toBeTruthy()` with a line-disable so the unsafe autofix can't re-break it. (The lunorash surface test's failure was stale-dist build ordering, green on a clean build.) - **prettier**: formatted the files the error-fix edits left unformatted (shard-do.ts, observability.ts). - **api surface**: regenerated the 2 drifted snapshots — a benign `CtxLogger`→`ContextLogger` rename and `readonly string[]`→`ReadonlyArray<string>`, both consistent (lint:types passes). Verified: full suite 48/48, lint:types 59/59, 0 eslint errors. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0197KjhmBDB3PXAc6TXiPqZ9
instruments-trend.png (a profiling PNG) slipped into the previous commit via a broad git add. Remove it and gitignore it. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0197KjhmBDB3PXAc6TXiPqZ9
55df34f to
107d6e3
Compare
…onto alpha Completes the rebase of the ctx.trace/ctx.metrics work onto alpha (which now carries the TS6 lint toolchain from #150). Regenerates the do/studio api snapshots to match the merged code and applies prettier to the hand-resolved conflict files. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0197KjhmBDB3PXAc6TXiPqZ9
… alpha Rebasing the ctx.trace/ctx.metrics work onto alpha put its new code under the now-working lint toolchain (from #150) for the first time, surfacing ~140 errors. All fixed to zero (the CI eslint gate); the ~188 remaining warnings are the repo-wide advisory test-hygiene debt, non-blocking and shared with alpha. Notable, beyond the mechanical autofixes (import sorting, ReadonlyArray, jsdoc): - prevent-abbreviations: renamed CtxTracer/CtxMetrics -> Context* and the file ctx-telemetry.ts -> context-telemetry.ts, matching alpha's convention (it had already renamed CtxLogger -> ContextLogger via #150). - span-buffer: a real find — the depth-walk's `while (current !== undefined)` was statically always-true (the loop breaks before it would assign an absent parent), so it became `for (;;)` driven by its internal breaks. Every sort()/reverse() there is on a fresh/local array, so toSorted()/toReversed() are behavior-identical. - prefer-single-call on `buffer.push(a); buffer.push(b)` in the metric/span tests is a FALSE POSITIVE — SpanBuffer/MetricBuffer.push are single-arg custom methods, not Array#push, so combining the calls would silently drop all but the first. File-level disables with that rationale. - prefer-strict-boolean-matchers auto-converted `getByTestId(...).toBeTruthy()` to `.toBe(true)` in the traces panel test — but a DOM element is truthy, not `=== true`, so it broke the test. Reverted with a file-level disable so the unsafe autofix can't re-apply. - two cognitive-complexity thresholds (the DO's central `fetch` router and the flat admin-RPC dispatch chain, each 1-2 over after the trace/metrics branches) and one member-ordering: justified disables rather than risky refactors of hot-path code. Verified: 0 eslint errors, lint:types 59/59, full test suite 48/48, api snapshots regenerated. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0197KjhmBDB3PXAc6TXiPqZ9
What & why
ESLint has been crashing at plugin load ever since the TS7-native migration:
Root cause: TypeScript 7 is the native (Go) rewrite, and its root package export dropped the classic JS API —
SyntaxKind,readConfigFile,createProgram, … moved undertypescript/unstable/*. Classic-API consumers in the lint toolchain (eslint-plugin-sonarjs,ts-api-utils, the@typescript-eslint/*chain) read that API eagerly at module load and blow up on the 7.0 export.Why an
overridespin, not just the catalogThe
catalog:tscentry governs only our workspace packages. The lint tools range-depend ontypescript(sonarjs pulls it as an optional dep with a*range) and resolve it independently — picking the highest published, which is 7.0. So downgrading the catalog lefttypescript@7.0.2in the graph and sonarjs still crashing. A globaloverrides: { typescript: 6.0.3 }is what actually collapses every resolution onto one compiler (verified:typescript@7.0.2now has 0 refs in the lockfile).Why 6.0 is safe here
TypeScript 6.0 is the last classic-codebase release and carries the full JS API, so it keeps every consumer — build, typecheck, and lint — on one working compiler. The packem/oxc
.d.tsbuild is unaffected: it generates declarations via oxc's isolated-declarations path, not tsgo, so it never needed the 7.0 root in the first place. (Confirmed empirically — the build passes on 6.0.3.)See typescript-eslint#10940: native tsgo support in typescript-eslint is 1–2 majors out, so classic TypeScript is the supported path for typed linting today.
Verification (on 6.0.3)
build:packages— 47/47lint:types— 59/59 projectstest— 48/48 projectseslint .now runs (sonarjs resolvestypescript@6.0.3,SyntaxKindpresent) instead of crashing.With ESLint dead since the migration, lint errors accumulated across ~48 files on
alpha(every PR merged in that window skipped the lint gate). This PR does not fix them — it only makes the linter runnable again. The debt is a mix of autofixable issues (import sorting,exports-last) and judgment calls (the intentionalvoid(… satisfies …)isolated-declarations pattern now trippingno-void/sonarjs/void-use,no-secretsfalse-positives on type-name strings,prevent-abbreviationsonCtxLogger). ~5 of those files overlap the in-flight observability PR #149, so the cleanup is best done as its own pass to avoid conflicts.🤖 Generated with Claude Code
Summary by CodeRabbit
Documentation
Refactor
Chores