Skip to content

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

Merged
iclanton merged 1 commit into
microsoft:mainfrom
bartvandenende-wm:bartvandenende-wm/fix-pnpm-config-jsonc
Jun 6, 2026
Merged

fix: [rush] Parse pnpm-config.json with JsonSyntax.JsonWithComments#5820
iclanton merged 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

@iclanton iclanton merged commit 2ee05e6 into microsoft:main Jun 6, 2026
6 checks passed
@github-project-automation github-project-automation Bot moved this from Needs triage to Closed in Bug Triage Jun 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Closed

Development

Successfully merging this pull request may close these issues.

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

2 participants