Skip to content

fix: [rush] Parse pnpm-config.json with JsonSyntax.JsonWithComments#5820

Open
bartvandenende-wm wants to merge 1 commit into
microsoft:mainfrom
bartvandenende-wm:bartvandenende-wm/fix-pnpm-config-jsonc
Open

fix: [rush] Parse pnpm-config.json with JsonSyntax.JsonWithComments#5820
bartvandenende-wm wants to merge 1 commit into
microsoft:mainfrom
bartvandenende-wm:bartvandenende-wm/fix-pnpm-config-jsonc

Conversation

@bartvandenende-wm
Copy link
Copy Markdown
Contributor

@bartvandenende-wm bartvandenende-wm commented Jun 6, 2026

Summary

Fixes #5813.

ProjectChangeAnalyzer parses the current pnpm-config.json with a comment-tolerant loader, but parsed the historical git blob with strict JSON.parse. Any repo who uses the default pnpm config template shipped with rush fell into the "created or unparseable" branch on every diff — flagging every project as impacted and writing a diagnostic to stdout, which corrupts rush list --json --impacted-by.

Details

Two small changes in ProjectChangeAnalyzer._detectCatalogChangesAsync:

  • Parse the old blob with JsonFile.parseString(...) from @rushstack/node-core-library, consistent with how the live file is loaded via NonProjectConfigurationFile.
  • Route the diagnostic through terminal.writeWarningLine (stderr), matching the surrounding diagnostics in this file.

How it was tested

Added one targeted regression test in ProjectChangeAnalyzer.test.ts that feeds the analyzer an old pnpm-config.json blob containing // and /* */ comments with catalogs identical to current, and asserts zero projects are flagged — pre-fix this would have parse-failed and flagged every catalog-using project.

Impacted documentation

N/A

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

Labels

None yet

Projects

Status: Needs triage

Development

Successfully merging this pull request may close these issues.

[rush] ProjectChangeAnalyzer treats commented pnpm-config.json as unparseable

1 participant