fix(tsconfig): walk up for non-TS and allowJs-off .js importers#1216
Merged
Boshen merged 1 commit intoJun 17, 2026
Conversation
Boshen
pushed a commit
that referenced
this pull request
Jun 17, 2026
## 🤖 New release * `oxc_resolver`: 11.21.0 -> 11.21.1 * `oxc_resolver_napi`: 11.21.0 -> 11.21.1 <details><summary><i><b>Changelog</b></i></summary><p> ## `oxc_resolver` <blockquote> ## [11.21.1](v11.21.0...v11.21.1) - 2026-06-17 ### <!-- 1 -->🐛 Bug Fixes - *(tsconfig)* walk up for non-TS and `allowJs`-off `.js` importers ([#1216](#1216)) (by @shulaoda) - *(tsconfig)* honor explicit non-TS extensions in `include` ([#1213](#1213)) (by @shulaoda) ### <!-- 2 -->🚜 Refactor - *(cache)* replace papaya with dashmap ([#1214](#1214)) (by @Boshen) ### <!-- 6 -->🧪 Testing - verify node_modules canonicalization across layouts ([#1200](#1200)) (by @Boshen) ### Contributors * @shulaoda * @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>
Merging this PR will not alter performance
Warning Please fix the performance issues or acknowledge them on CodSpeed. Performance Changes
Tip Investigate this regression by commenting Comparing Footnotes
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to #1213. When auto-discovering a
tsconfig.jsonfor an importer,claims_ownership_oftreated any file the tsconfig doesn't compile as "owned by the nearest tsconfig" and stopped the upward walk. That blanket shortcut intercepted files that an ancestor project genuinely owns.The problem
The guard was:
is_file_extension_allowed_in_tsconfigis true only for TS extensions (and JS whenallowJsis on), so the negation claimed non-TS files (.vue,.css), extensionless paths, andallowJs-off.jsalike. Two concrete failures:tsconfig.jsonincluding only**/*.tswould claim a siblingApp.vue. Auto-discovery stopped at the child, so a solution root that references a config withinclude: ["src/**/*.vue"]and a@/*alias never owned the file and the alias didn't resolve.allowJs-off.jsleaks a referenced project'spaths. A referenced project withallowJsoff butinclude: ["src/**/*.js"]would still route a.jsimporter through itself, applying its@lib/*paths to a file TypeScript excludes from the program.The fix
claims_ownership_of— narrow the earlyreturn truetopath.extension().is_none(). A directory (extensionless importer) isn't a file, sofiles/includeownership doesn't apply and the nearest enclosing tsconfig governs it (many discovery cases rely on itspaths/baseUrl/extends). A genuine file — including anallowJs-off.jsthis config won't compile — is claimed only when actually owned, otherwise the walk continues up.is_file_included_in_tsconfig— reject non-program inputs (anallowJs-off.js, even when a glob names.js; or an extensionless path) before consultinginclude, soresolve_tsconfig_solutionwon't route such files to a referenced project.is_extensionless_or_uncompiled_jsto share that predicate.Directory importers are unchanged: they still resolve against their nearest tsconfig (verified by the existing
tsconfig_discoverycases).Tests
solution_style_nested_non_ts_walks_up(new) — a child config including only**/*.tsno longer interceptsApp.vue; the walk reaches the solution project that owns@/*. A.tsthe child includes stays on the child; anallowJs-offlegacy.jswalks up like the.vue.referenced_config_drops_js_when_allow_js_off(new) — a.tsimporter resolves@lib/*; a.jsimporter does not (dropped becauseallowJsis off).solution_style_non_ts_extensions(updated) — a.cssmatched by noincludewalks past the solution root to the outermost ancestor, and the@/*alias does not leak into it.New fixtures under
fixtures/tsconfig/cases/referenced-allow-js-off/andfixtures/tsconfig/cases/solution-style-non-ts/src/feature/.