Skip to content

Fix/format readme go names - #64940

Open
Leigh Griffin (lgriffin) wants to merge 2 commits into
microsoft:mainfrom
lgriffin:fix/format-readme-go-names
Open

Leigh Griffin (lgriffin) wants to merge 2 commits into
microsoft:mainfrom
lgriffin:fix/format-readme-go-names

Conversation

@lgriffin

Copy link
Copy Markdown

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.md still describes the TypeScript 6 formatter:

  • It links ./rules.ts, which doesn't exist. The rules are in rules.go.
  • It says processPair gets rules "via createRulesMap". In the Go port, processPair calls getRules (span.go), which reads the map buildRulesMap builds once (rulesmap.go).

Changes

  • README: point the link at rules.go and name getRules and buildRulesMap.
  • New 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/ and npx hereby check:format pass.

AI disclosure: co-written with Claude Code and reviewed / tested by me. The stale names were found with CSH which was written with Claude.

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.
Copilot AI balanced review requested due to automatic review settings October 23, 2026 18:43
@github-project-automation github-project-automation Bot moved this to Not started in PR Backlog Oct 23, 2026
@typescript-automation typescript-automation Bot added the For Uncommitted Bug PR for untriaged, rejected, closed or missing bug label Oct 23, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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.go and replaces createRulesMap with getRules and buildRulesMap.
  • 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

@lgriffin

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

For Uncommitted Bug PR for untriaged, rejected, closed or missing bug

Projects

Status: Not started

Development

Successfully merging this pull request may close these issues.

Formatter README links rules.ts and names createRulesMap, which the Go port does not have

2 participants