Repository navigation
Fill the config cycle into the TS18000 circularity message - #65091
Open
Christopher Plieger (cplieger) wants to merge 1 commit into
Open
Christopher Plieger (cplieger) wants to merge 1 commit into
Christopher Plieger (cplieger) wants to merge 1 commit into
Conversation
Contributor
|
This PR doesn't have any linked issues. Please open an issue that references this PR. From there we can discuss and prioritise. |
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported for the change to include the circular configuration chain in TS18000 diagnostics.
No open issues 🎉
What changed in this PR
Fixes TS18000’s unfilled {0} placeholder by including the circular configuration chain. Reporting only the cycle keeps the message relevant when cached errors are reused by other projects.
Changes:
- Formats the cycle’s config paths with
->, including the path that closes the cycle. - Adds a regression test verifying the diagnostic argument excludes the project leading into the cycle.
| File | Description |
|---|---|
tsc/internal/tsoptions/tsconfigparsing.go |
Supplies the cycle path chain to TS18000. |
tsc/internal/tsoptions/tsconfigparsing_test.go |
Verifies one circularity diagnostic with the expected cycle argument. |
Review effort: Balanced
This branch has not been deployed
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.
parseConfigreports TS18000 when a config'sextendschain returns to a config already on the resolution stack, but it passes no argument for the message's{0}. The text then readsCircularity detected while resolving configuration: {0}on the CLI and through the API.Impact: the message names no config, so in a repository with many configs the user has to find the cycle by hand, and a tool on the API shows the raw placeholder.
parseConfignow passes the configs of the cycle, from the first one on the resolution stack to the config that closes it, joined with->. Strada'sparseConfigpasses the whole stack. Here an extended config's parse, with its errors, is cached by path and reused by every project that reaches it, so the whole stack would name the project that filled the cache. The cycle alone holds for every project that reaches it, so a reused entry still names the right configs, though it may start the cycle at another of them. The paths are the stack's path keys.TestParseJsonSourceFileConfigFileContentReportsCircularExtendsChainparsestsconfig.json, which extendsa.json, wherea.jsonandb.jsonextend each other, and expects one TS18000 whose argument is/project/a.json -> /project/b.json -> /project/a.json. Onmainthe diagnostic has no argument.I met this while building deadset-ts, the TypeScript analyzer of deadset, on the TypeScript 7 API, and noted it in #64755 and #64825 as a separate cause.
An AI coding agent wrote this patch. I have read, built and tested it and will handle the review.
Backlogmilestone (required)mainbranchnpx hereby testnpx hereby lintnpx hereby check:formatFixes #65094