fix(tsconfig): scope default **/* include to the tsconfig directory#1161
Conversation
The default `include = **/*` was matching every path regardless of where the tsconfig sat, so a referenced sub-project with no `files`/`include` of its own claimed files outside its directory and shadowed the parent's `compilerOptions.paths`. Combined with the solution-style heuristic treating omitted `files`/`include` the same as explicit `[]`, a root tsconfig with `references` and `paths` but no `include` lost its own paths for files it owns via the default glob. Mirrors typescript-go, where `getFileNamesFromConfigSpecs` expands the default `**/*` via `ReadDirectory(basePath, ...)` and is therefore naturally scoped to the project directory. Closes #1159.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1161 +/- ##
==========================================
- Coverage 93.34% 93.31% -0.03%
==========================================
Files 22 22
Lines 4177 4174 -3
==========================================
- Hits 3899 3895 -4
- Misses 278 279 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Merging this PR will not alter performance
Comparing Footnotes
|
af38e2f to
194d8c8
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: af38e2ff15
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
## 🤖 New release * `oxc_resolver`: 11.19.2 -> 11.20.0 * `oxc_resolver_napi`: 11.19.2 -> 11.20.0 <details><summary><i><b>Changelog</b></i></summary><p> ## `oxc_resolver` <blockquote> ## [11.20.0](v11.19.2...v11.20.0) - 2026-05-27 ### <!-- 0 -->🚀 Features - *(tsconfig)* parse `strict` and `strictNullChecks` compiler options ([#1166](#1166)) (by @kylecannon) ### <!-- 1 -->🐛 Bug Fixes - *(tsconfig)* scope default `**/*` include to the tsconfig directory ([#1161](#1161)) (by @Boshen) ### Contributors * @kylecannon * @Boshen </blockquote> </p></details> --- This PR was generated with [release-plz](https://github.com/release-plz/release-plz/). Co-authored-by: oxc-guard[bot] <276638029+oxc-guard[bot]@users.noreply.github.com>
Summary
The default
include = **/*was matching every path regardless of where the tsconfig sat, so a referenced sub-project with nofiles/includeof its own claimed files outside its own directory and shadowed the parent'scompilerOptions.paths. Combined with the solution-style heuristic treating omittedfiles/includethe same as explicit[], a root tsconfig withreferencesandpathsbut noincludelost its own paths for files it owns via the default glob.Repro
tsc 6.0.3andtsgo 7.0.0-devboth resolve@app/util→src/util.ts. oxc-resolver 11.19.1 did too; 11.19.2 returnsCannot find module.Root cause
Two interacting bugs:
is_glob_matches(_, GlobPattern::All)short-circuited**/*totrueregardless of which tsconfig owned the pattern. Fine when the only caller was the walked-up parent tsconfig, broken after fix(tsconfig): let project references take priority over their parent #1151 started asking references the same question — their**/*then matched files outside the reference's directory.claims_ownership_of's solution-style check usedis_none_or(Vec::is_empty), conflating omitted and explicit-emptyfiles/include. Per the TS spec only an explicit[]means "own no files"; an omittedincludedefaults to**/*and should fall through.This mirrors typescript-go's structure:
getFileNamesFromConfigSpecsexpands the default**/*viaReadDirectory(basePath, ...), which is naturally scoped to the project directory — no equivalent "literal**/*matches everywhere" code path exists there.Changes
src/tsconfig.rs—GlobPattern::Allnow checkspath.starts_with(self.directory());is_solution_stylerequires explicitSome([])for bothfilesandinclude. DeadGLOB_ALL_PATTERNconstant removed.src/tests/tsconfig_project_references.rs—root_paths_apply_to_default_include_filescovers the repro.fixtures/tsconfig/cases/project-references-default-include/— minimal fixture matching the issue.All 294 existing tests still pass.
Closes #1159.