Skip to content

chore(deps): pin typescript to 6.0.3 so the lint toolchain runs again - #150

Merged
prisis merged 5 commits into
alphafrom
chore/typescript-6-lint-toolchain
Jul 21, 2026
Merged

chore(deps): pin typescript to 6.0.3 so the lint toolchain runs again#150
prisis merged 5 commits into
alphafrom
chore/typescript-6-lint-toolchain

Conversation

@prisis

@prisis prisis commented Jul 20, 2026

Copy link
Copy Markdown
Member

What & why

ESLint has been crashing at plugin load ever 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 at module load and blow up on the 7.0 export.

Why an overrides pin, not just the catalog

The catalog:tsc entry governs only our workspace packages. The lint tools range-depend on typescript (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 left typescript@7.0.2 in the graph and sonarjs still crashing. A global overrides: { typescript: 6.0.3 } is what actually collapses every resolution onto one compiler (verified: typescript@7.0.2 now 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.ts build 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:packages47/47
  • lint:types59/59 projects
  • test48/48 projects
  • eslint . now runs (sonarjs resolves typescript@6.0.3, SyntaxKind present) instead of crashing.

⚠️ Follow-up: this re-enables ESLint, which surfaces accumulated debt

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 intentional void(… satisfies …) isolated-declarations pattern now tripping no-void/sonarjs/void-use, no-secrets false-positives on type-name strings, prevent-abbreviations on CtxLogger). ~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

    • Clarified structured logging fields and usage examples across logging APIs.
    • Corrected formatting and HTML escaping in logging documentation.
  • Refactor

    • Refined logging type exports and internal logger typings without changing behavior.
    • Simplified type declarations while preserving existing interfaces and functionality.
  • Chores

    • Addressed linting and formatting warnings across CLI, runtime, code generation, and integrations.

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
@netlify

netlify Bot commented Jul 20, 2026

Copy link
Copy Markdown

Deploy Preview for lunorash ready!

Name Link
🔨 Latest commit 107d6e3
🔍 Latest deploy log https://app.netlify.com/projects/lunorash/deploys/6a5eae5598e2a60008a94970
😎 Deploy Preview https://deploy-preview-150--lunorash.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions

Copy link
Copy Markdown
Contributor

Thank you for following the naming conventions! 🙏

@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@prisis, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 32 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 4c2361ad-95b0-4d93-b64e-59a4eb769779

📥 Commits

Reviewing files that changed from the base of the PR and between 12e9f86 and 107d6e3.

⛔ Files ignored due to path filters (4)
  • .gitignore is excluded by none and included by none
  • api-snapshots/do.api.md is excluded by none and included by none
  • api-snapshots/errors.api.md is excluded by none and included by none
  • packages/studio/__tests__/features/auth/organization-detail.test.tsx is excluded by !**/__tests__/** and included by packages/**
📒 Files selected for processing (2)
  • packages/do/src/shard-do.ts
  • packages/runtime/src/observability.ts

Walkthrough

The 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.

Changes

Logging and cross-package alignment

Layer / File(s) Summary
Logger contracts and observability wiring
packages/do/src/request-log.ts, packages/do/src/shard-do.ts, packages/runtime/src/observability*.ts
Logger types and shared type re-exports are aligned, log-field prototype handling is explicitly typed, and OTLP attributes are initialized with the function path entry.
Structured logging documentation and imports
packages/config/src/log-format.ts, packages/do/src/log-buffer.ts, packages/server/src/types.ts, packages/studio/src/lib/admin.ts, packages/studio/src/features/logs/logs-panel.tsx, packages/runtime/src/observability-sinks.ts
Structured logging examples and field documentation are clarified, while the Studio formatter import is moved into the main import block.
Lint and type declaration cleanup
packages/cli/src/util/*, packages/codegen/src/capabilities.ts, packages/errors/src/catalog.ts, packages/nuxt/src/module.ts, packages/x402/src/networks.ts
Lint directives are added for existing declaration and import patterns, ErrorHint uses ReadonlyArray<string>, and the CLI format set relies on inferred typing.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is informative but does not follow the required template and omits Summary, Linked issues, Test plan, Checklist, Notes, and CLA. Reformat the PR body to match the template and add the missing Summary, Linked issues, Test plan, Checklist, Notes for reviewers, and CLA sections.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: pinning TypeScript to 6.0.3 to restore the lint toolchain.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/typescript-6-lint-toolchain

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown
Contributor

Thank you for confirming the Contributor License Agreement! 🙏

@prisis
prisis enabled auto-merge July 20, 2026 21:49
@codspeed-hq

codspeed-hq Bot commented Jul 20, 2026

Copy link
Copy Markdown

Merging this PR will regress 1 benchmark

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

⚡ 1 improved benchmark
❌ 1 regressed benchmark
✅ 158 untouched benchmarks
⏩ 1 skipped benchmark1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

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

Open in CodSpeed

Footnotes

  1. 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.

  2. 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.

prisis and others added 2 commits July 21, 2026 00:41
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
@github-actions

github-actions Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

React Doctor found no new issues. 🎉

Reviewed by React Doctor for commit 107d6e3.

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
@prisis
prisis force-pushed the chore/typescript-6-lint-toolchain branch from 55df34f to 107d6e3 Compare July 20, 2026 23:25
@prisis
prisis disabled auto-merge July 21, 2026 06:20
@prisis
prisis merged commit 411b98b into alpha Jul 21, 2026
39 of 43 checks passed
@prisis
prisis deleted the chore/typescript-6-lint-toolchain branch July 21, 2026 06:21
prisis added a commit that referenced this pull request Jul 21, 2026
…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
prisis added a commit that referenced this pull request Jul 21, 2026
… 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant