fix(tsconfig): treat a missing extends target as non-fatal#1205
Open
webpro wants to merge 1 commit into
Open
Conversation
…ject#1185) `tsconfig: 'auto'` (or an explicit config) returned no result for every specifier under a tsconfig whose `extends` target can't be resolved — a package that isn't installed, or a generated config that doesn't exist yet (e.g. Nuxt's `.nuxt/tsconfig*.json` before `nuxt prepare`). tsc / typescript-go report TS6053 and keep resolving with the options that parsed. Skip a missing `extends` base — both a bare-package `TsconfigNotFound` and a missing relative target — and carry on. Unreadable (`IOError`) and malformed (`Json`) bases stay fatal; circular `extends` and missing `references` are unaffected. Also flips the two tests that asserted the old fatal behavior, and excludes the `extends-not-found` case from the tsconfck `parse/invalid` conformance set (tsconfck classifies a missing extends as invalid; tsc/tsgo don't).
Member
|
This is a hard one, I'll get to this soon. |
Author
|
Opened the PR because went through a few rabbit holes this morning, Claude still had good context and figured a PR might help. No hurries from our end. For context: got triggered by webpro-nl/knip#1778 and pushed a workaround over there. If patches ship with oxc-resolver, I've verified we can remove this: webpro-nl/knip@91d6999 |
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
With
tsconfig: 'auto'(or an explicit config), oxc-resolver returns no result for every specifier under a tsconfig whoseextendstarget can't be resolved — a package that isn't installed, or a generated config that doesn't exist yet (e.g. Nuxt's.nuxt/tsconfig*.jsonbeforenuxt prepare, or any config on a fresh clone before deps are installed).tsc/typescript-goreport TS6053 ("File … not found") and keep resolving with the options that did parse. This makes oxc-resolver match that.Closes #1185.
Change
Skip a missing
extendsbase and carry on, rather than failing:TsconfigNotFound, andStill fatal / unchanged: unreadable (
IOError) and malformed (Json) bases; circularextends; missingreferences.Reproduction
resolve_file("a.ts", "./b")withtsconfig: 'auto':Err(TsconfigNotFound("@acme/not-installed/tsconfig.json"))Ok(".../b.ts")— matchingtsc/tsgoTests
test_extend_package_not_found_still_resolves,test_extend_relative_not_found_still_resolves.test_extend_tsconfig_not_foundand the undefined-#-import case intest_extend_imports(nowOk); theextends-not-foundrow intsconfig_paths(nowNotFound("ts-path")).extends-not-foundfrom thetsconfck parse/invalidset —tsconfckclassifies a missingextendsas invalid;tsc/tsgodon't.This is independent of the
extends-inheritedinclude/rootDirsfix (separate PR) and does not touch thereferencespath.