Repository navigation
Fix/format readme go names - #64940
Open
Leigh Griffin (lgriffin) wants to merge 2 commits into
Open
Leigh Griffin (lgriffin) wants to merge 2 commits into
Leigh Griffin (lgriffin) wants to merge 2 commits into
Conversation
The formatter README linked rules.ts and said processPair requests rules via createRulesMap. Neither exists in the Go port: the rules are in rules.go, and processPair calls getRules, which reads the map buildRulesMap builds once. Found with CSH (https://github.com/lgriffin/CSH).
The test fails if README.md links to a file that does not exist, or mentions a backticked identifier that the package neither declares nor uses. Against the old README it reports the two stale TypeScript 6 names fixed in the previous commit.
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The documentation corrections match the Go implementation, and static review identified no blocking issues in the regression test.
No open issues 🎉
What changed in this PR
Fixes #64939 by updating the formatter README to match the Go implementation and adding a regression test for stale documentation references.
Changes:
- Corrects the rules link to
rules.goand replacescreateRulesMapwithgetRulesandbuildRulesMap. - Adds checks for missing linked files and unrecognized backticked identifiers.
| File | Description |
|---|---|
tsc/internal/format/README.md |
Corrects the formatter’s documented file and function names. |
tsc/internal/format/readme_test.go |
Adds regression checks for README links and identifier references. |
Review effort: Balanced
Author
|
@microsoft-github-policy-service agree |
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.
Fixes #64939
Hey folks, First time contributor so hopefully I have gotten everything right here. I'm lacking the Backlog tag but wanted to open the PR given I have a fix for it. I'm building a small static analysis tool called CSH. Here's what it picked up:
tsc/internal/format/README.mdstill describes the TypeScript 6 formatter:./rules.ts, which doesn't exist. The rules are inrules.go.processPairgets rules "viacreateRulesMap". In the Go port,processPaircallsgetRules(span.go), which reads the mapbuildRulesMapbuilds once (rulesmap.go).Changes
rules.goand namegetRulesandbuildRulesMap.readme_test.go(TestReadmeMatchesCode): fails if the README links a missing relative file, or names a backticked identifier the package neither declares nor uses. Against the old README it reports exactly the two problems above.Testing:
go test ./internal/format/andnpx hereby check:formatpass.AI disclosure: co-written with Claude Code and reviewed / tested by me. The stale names were found with CSH which was written with Claude.