Skip to content

fix: constrain root tsconfig project scope#1273

Draft
NathanDrake2406 wants to merge 1 commit into
cloudflare:mainfrom
NathanDrake2406:nathan/fix-root-tsconfig-scope
Draft

fix: constrain root tsconfig project scope#1273
NathanDrake2406 wants to merge 1 commit into
cloudflare:mainfrom
NathanDrake2406:nathan/fix-root-tsconfig-scope

Conversation

@NathanDrake2406
Copy link
Copy Markdown
Contributor

Overview

Area Details
Goal Keep the root TypeScript project limited to vinext root-owned code.
Core change Add an explicit root tsconfig.json include list for root config files, packages/vinext/src, and root tests.
Regression coverage Add tests/root-tsconfig.test.ts to parse the root config and assert independent app files, package build output, and local worktree dirs stay outside the root project.
Expected impact Standard TypeScript tooling no longer reports apps/web alias or Cloudflare type errors through the root vinext package project.

Why

The root quality config should describe the vinext package workspace boundary, not every TypeScript file that happens to exist under the checkout. Without an explicit include list, TypeScript falls back to a repo-wide default and pulls in independent app files plus generated declaration output.

What changed

Before After
Root tsconfig.json relied on implicit file inclusion plus exclusions. Root tsconfig.json opts in to root TS files, vinext source, and tests.
tsc --showConfig --project tsconfig.json included apps/web/** and packages/vinext/dist/**/*.d.ts. The parsed root config reports 0 files under apps/, packages/vinext/dist/, .claude/, and .worktrees/.

Validation

  • vp test run tests/root-tsconfig.test.ts
  • vp check tests/root-tsconfig.test.ts
  • vp fmt --check tsconfig.json tests/root-tsconfig.test.ts
  • npx tsc --showConfig --project tsconfig.json --pretty false inspected with a small Node check, confirming 0 absorbed files under apps/, packages/vinext/dist/, .claude/, and .worktrees/
  • npx tsc --noEmit --project tsconfig.json --pretty false still fails on pre-existing tests/app-fallback-renderer.test.ts TS2322 fixture typing errors, but the reported apps/web alias and Cloudflare type errors are gone.

Notes

The local commit hook was bypassed because it attempted to format checked-out reference repositories under .refs/ and failed on intentional syntax-error fixtures there. The targeted repo checks above were run after that failure.

The root TypeScript project previously relied on TypeScript's implicit include set, which pulled independent workspace app files and nested package build output into root tooling. That made standard tsc checks report app-local alias and Workers type errors through the vinext package project.

Add an explicit include list for root-owned config files, vinext source, and root tests. Cover the boundary with a regression test that asserts independent apps, generated package output, and local worktree directories stay outside the parsed root project.
@NathanDrake2406 NathanDrake2406 marked this pull request as ready for review May 16, 2026 14:35
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 16, 2026

Open in StackBlitz

npm i https://pkg.pr.new/vinext@1273

commit: 06d7d0e

@james-elicx
Copy link
Copy Markdown
Collaborator

/bigbonk review

Copy link
Copy Markdown
Contributor

@ask-bonk ask-bonk Bot left a comment

Choose a reason for hiding this comment

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

Clean, well-scoped change. The include list correctly constrains the root project to root config files + vinext source + tests, and the regression test is thorough. Two minor observations below, neither blocking.

Comment thread tsconfig.json
"tests/**/*.ts",
"tests/**/*.tsx"
],
"exclude": ["node_modules", "dist", "fixtures", "tests/fixtures", "benchmarks", "examples"]
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.

Nit: With an explicit include, most of the exclude entries are now redundant — node_modules, dist, fixtures, benchmarks, and examples are already outside the include globs. The only entry that still does work is tests/fixtures (since tests/**/*.ts would otherwise pull in fixture files).

Not a blocker — the extra excludes are harmless as defense-in-depth — but if you want to tidy this up later, the exclude could be trimmed to just ["tests/fixtures"].

expect(fileNames.some((fileName) => fileName.startsWith("apps/"))).toBe(false);
expect(fileNames.some((fileName) => fileName.startsWith("packages/vinext/dist/"))).toBe(false);
expect(fileNames.some((fileName) => fileName.startsWith(".claude/"))).toBe(false);
expect(fileNames.some((fileName) => fileName.startsWith(".worktrees/"))).toBe(false);
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.

The PR description mentions .refs/ as a directory that existed and caused issues during formatting. It's gitignored (or at least not committed), but if someone has it locally, include already keeps it out. If you wanted to be thorough, you could add a .refs/ assertion here too — but it's a truly optional polish since the directory isn't in the repo.

@ask-bonk
Copy link
Copy Markdown
Contributor

ask-bonk Bot commented May 16, 2026

Review submitted. Here's a summary:

Approved with two minor, non-blocking observations:

  1. Redundant exclude entries — With the explicit include list, most of the exclude entries (node_modules, dist, fixtures, benchmarks, examples) are now outside the include globs and don't need explicit exclusion. Only tests/fixtures still does meaningful work. The extras are harmless as defense-in-depth but could be trimmed later.

  2. Optional .refs/ assertion in the test — The PR description mentions .refs/ causing formatting issues. While it's not committed to the repo, adding an assertion for it in the test would be consistent with the .claude/ and .worktrees/ checks. Purely optional polish.

The change is correct: the include list properly scopes the root tsconfig to *.ts/*.tsx at root (covers vite.config.ts, knip.ts, playwright.config.ts), packages/vinext/src/**, and tests/**. The regression test uses the TypeScript API to parse the config and verify the exclusions, which is a solid approach.

github run

Comment on lines +35 to +38
expect(fileNames.some((fileName) => fileName.startsWith("apps/"))).toBe(false);
expect(fileNames.some((fileName) => fileName.startsWith("packages/vinext/dist/"))).toBe(false);
expect(fileNames.some((fileName) => fileName.startsWith(".claude/"))).toBe(false);
expect(fileNames.some((fileName) => fileName.startsWith(".worktrees/"))).toBe(false);
Copy link
Copy Markdown
Collaborator

@james-elicx james-elicx May 16, 2026

Choose a reason for hiding this comment

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

dist entries should already be excluded. you can add .claude, .worktrees, .nextjs-ref, etc. to exclude if you want? otherwise, i'd rather it includes everything in the repo and excludes stuff that isn't part of the repo. there is also no need for a test file for this.

@james-elicx james-elicx marked this pull request as draft May 16, 2026 19:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants