Skip to content

ref(tsconfig): Extend one shared base tsconfig from every package - #2238

Closed
JoshuaKGoldberg wants to merge 3 commits into
josh/lint-no-unnecessary-condition-clifrom
josh/tsconfig-shared-base
Closed

JoshuaKGoldberg wants to merge 3 commits into
josh/lint-no-unnecessary-condition-clifrom
josh/tsconfig-shared-base

Conversation

@JoshuaKGoldberg

@JoshuaKGoldberg JoshuaKGoldberg commented Nov 13, 2026 •

Copy link
Copy Markdown
Member

Adds a root tsconfig.base.json that every package extends, replacing the @sentry/mcp-server-tsconfig package, without changing any package's type-checking options.

The next PRs in this stack apply the same strictness everywhere, following #2186 (comment).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
sentry-local Skipped Skipped Nov 13, 2026 4:09pm UTC

Request Review

@BYK BYK left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

She said yes! 💍

@JoshuaKGoldberg

Copy link
Copy Markdown
Member Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit cbffd53. Configure here.

@joshuarli

Copy link
Copy Markdown
Member

Superseded by #2266. All of this branch's changes are carried there, rebased onto the base branch.

@joshuarli joshuarli closed this Nov 18, 2026
joshuarli added a commit that referenced this pull request Nov 18, 2026
Toolkit was on TypeScript 5.9 and pnpm 11, each project had its own
type-check settings, and many tests, scripts, Worker and build configs
were never type-checked in CI. This moves the workspace to TypeScript
7.0.2 and pnpm 12.18.0, applies one strict tsconfig policy to every
maintained TypeScript file, and adds stronger type-aware Oxlint rules.
Published package contracts are unchanged.

This single PR supersedes the stacked #2240,
#2187, #2238, and
#2239: everything those branches carried is here,
rebased onto current `main` (which also carries #2186). #2187's metric
alert query filter fix is included as a cherry-pick. It follows that
stack's layout: one root `tsconfig.base.json` that every project
extends, no `@sentry/mcp-server-tsconfig` package, and one root
`.oxlintrc.json`.

Intermediate commits are not individually green; squash-merge.

## Changes

- The root `tsconfig.base.json` keeps the stack's runtime defaults and
adds the rest of the checking policy. Projects set only runtime options
such as target, module, lib, types, JSX and emit. The policy enables:
- `strict`, `noUncheckedIndexedAccess`, `exactOptionalPropertyTypes`,
`noPropertyAccessFromIndexSignature`
  - `verbatimModuleSyntax`, `erasableSyntaxOnly`
  - the `noUnused*` checks
  - `skipLibCheck: false`
- Every package's sources, tests, scripts and build configs belong to a
program that its `typecheck` script runs.
- `scripts/tsconfig-policy.test.mjs` reads the policy from the root base
and guards against:
  - files left uncovered
  - weakened options
  - library-check exceptions without a stated reason
- Tooling upgrades:
- Oxlint 1.93 with tsrs-lint (tsrs 7.1.0-beta.tsrs3) for type-aware
rules, Oxfmt 0.78, tsdown 0.23
- Code generators that need the old compiler API now use
`@typescript/typescript6`.
- New lint rules for the whole repo: promise misuse, exhaustive
switches, `only-throw-error` and related safety rules.
- Non-test code outside the CLI, including apps/local, now also bans
`any`, `!`, unnecessary conditions and unsafe `any` flows.
- Bugs that stricter types exposed:
- mcp-cloudflare now rejects incomplete OAuth approval states and empty
HMAC signatures.
- mcp-cloudflare's `/api/chat` now returns a 500 for a non-`Error`
throw.
- apps/local's Web Vitals view no longer crashes when a page has no
metrics.
- The CLI's `command-api.json` regained the fixed query notes it had
lost.

## Impact

- pnpm 11 switches itself to 12.18.0 because of the `packageManager`
pin. The first switch adds `@pnpm/exe` entries to `pnpm-lock.yaml`;
discard them.
- `typecheck` is the canonical script. `tsc` remains as an alias.
- The quality job in CI builds `@sentry/mcp-core` and `@sentry/logger`
before lint, because type-aware rules read workspace packages through
their built declarations.

## Exceptions

- `packages/codemod-cli3to4/tsconfig.json` repeats the checking options
instead of extending the root, because `jssg` cannot resolve an
`extends` outside the package. The policy test fails if the copy drifts.
- 11 programs keep `skipLibCheck: true`, each with a comment naming the
dependency, the diagnostic and when to remove it:
- `ai` declarations (under `exactOptionalPropertyTypes`, and DOM or Node
names they reference)
- `@cloudflare/workers-types` conflicting with `@types/node` globals,
and `urlpattern-polyfill` against the workers-types `URLPattern` global
- `wrangler` and `miniflare` declarations referencing packages they
bundle but do not ship
- `unplugin` and `vite` declarations referencing packages they don't
ship
  - `hono` declarations using DOM names in the Node program
- `apps/cli-docs` keeps `astro check` on TypeScript 6 until
`@astrojs/check` supports TypeScript 7.
- Vitest is pinned to `~5.0.5`. Vitest 5.1 needs
`AsyncLocalStorage.disable()`, which workerd lacks. Remove the pin once
`@cloudflare/vitest-plugin` ≥ 1.7.0 is adopted.
- Type-aware lint runs on `tsrs-lint`, which tracks the TypeScript 7.1
beta. `pnpm run typecheck` stays on TypeScript 7.0 and is the type gate.
`.pnpmfile.cjs` drops oxlint's optional `oxlint-tsgolint` peer, which
pnpm 12 would otherwise install unused. tsrs3 is newer than the
release-age window, so its packages are in `minimumReleaseAgeExclude`.

## Open questions

- In mcp-cloudflare's `chat-message.tsx`, the tool-part state mapping
never sees `"result"` under AI SDK v6. That bug predates this PR and is
left as is.

Refs getsentry/junior#2171

<!-- junior-request-attribution:start -->
via @joshuarli.
<!-- junior-request-attribution:end -->

<!-- junior-session-footer:start -->
<!-- junior-conversation-id:local%3Aweb%3Af90a6d1952c6435371ab2bce -->

--

[View
Session](https://junior-prod.sentry.dev/conversations/local%3Aweb%3Af90a6d1952c6435371ab2bce)
[[Sentry]](https://sentry.sentry.io/explore/conversations/local%3Aweb%3Af90a6d1952c6435371ab2bce/?project=4510944073809921)

<!-- junior-session-footer:end -->

---------

Co-authored-by: Josh Goldberg ✨ <joshua.goldberg@sentry.io>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
Co-authored-by: Joshua Li <14209781+joshuarli@users.noreply.github.com>
Co-authored-by: Joshua Li <joshuarli98@gmail.com>
Co-authored-by: Inkling 2 Small Free <inkling-2-small-free@users.noreply.github.com>

This branch was successfully deployed

1 active and 1 inactive deployments
Actions — d1e96fbb Deployed Nov 13, 2026 by JoshuaKGoldberg via eval #1863
Preview — d1e96fbb Deployed Nov 13, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: medium PR risk score: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants