Skip to content

fix(config): warn on ignored settings in global config.yaml#11470

Merged
zkochan merged 2 commits into
mainfrom
ignore-global-settings
May 5, 2026
Merged

fix(config): warn on ignored settings in global config.yaml#11470
zkochan merged 2 commits into
mainfrom
ignore-global-settings

Conversation

@zkochan

@zkochan zkochan commented May 5, 2026

Copy link
Copy Markdown
Member

Summary

  • pnpm v11 silently drops local-only settings (e.g. nodeLinker, hoistPattern, linkWorkspacePackages) when they appear in the global config.yaml. Users had no way to tell their global configuration was being ignored.
  • The reader now emits a warning that names the ignored keys and the path of the global config file, and directs users to either move the settings to a project-level pnpm-workspace.yaml or share them across projects via config dependencies.
  • Allowed keys (e.g. dangerouslyAllowAllBuilds, proxy settings) continue to be accepted with no warning.

close #11429

Test plan

  • pnpm --filter @pnpm/config.reader run compile — typecheck and lint pass
  • New unit test in config/reader/test/index.ts writes a global config.yaml mixing allowed (dangerouslyAllowAllBuilds) and disallowed (nodeLinker, hoistPattern) keys; asserts the allowed key is applied, disallowed keys are dropped, and the warning includes the ignored keys, the config file path, the suggestion to use pnpm-workspace.yaml, and the link to config-dependencies docs (and does not mention .npmrc)
  • All existing global config.yaml tests still pass

Local-only settings such as `nodeLinker` or `hoistPattern` are not
allowed in the global `config.yaml` and were silently dropped, leaving
users guessing why their global configuration had no effect. Emit a
warning that lists the ignored keys and the path of the global config
file so the misconfiguration is visible.
@coderabbitai

coderabbitai Bot commented May 5, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

pnpm now warns users when disallowed global settings (e.g., nodeLinker, hoistPattern) appear in the global config.yaml, indicating that these settings are ignored. The warning includes guidance to move them to pnpm-workspace.yaml or use config dependencies.

Changes

Global Config Validation with Warnings

Layer / File(s) Summary
Changeset / Documentation
.changeset/warn-ignored-global-settings.md
Documents patch-level release for @pnpm/config.reader and pnpm, noting that warnings are now emitted for disallowed global settings.
Core Logic
config/reader/src/index.ts
When reading globalYamlConfig, non-config-file-key entries are accumulated in ignoredKeys and deleted. A warning is emitted (if any ignored keys exist) listing the ignored settings with the global config file path and guidance to use pnpm-workspace.yaml or config dependencies.
Tests / Verification
config/reader/test/index.ts
New test verifies that allowed settings from global config are applied, disallowed settings are ignored, and a warning is emitted containing the ignored keys and relevant file/docs references.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A warning hops into the config today,
"These settings don't belong here," it will say.
Global keys that stray from the path,
Get a gentle nudge—no silent wrath.
Guidance given with a friendly note,
Keeping configs sound, word by hoppy word! 🌱

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and accurately summarizes the main change: adding a warning when disallowed settings appear in the global config.yaml file, replacing the previous silent deletion behavior.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ignore-global-settings

Comment @coderabbitai help to get the list of available commands and usage tips.

Drop the .npmrc suggestion (pnpm only reads auth and network keys from
.npmrc) and point users to config dependencies for sharing settings
across projects.
@zkochan zkochan marked this pull request as ready for review May 5, 2026 14:56
Copilot AI review requested due to automatic review settings May 5, 2026 14:56

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.

Pull request overview

This PR improves UX around config/reader’s handling of global config.yaml by emitting a warning when project/workspace-only settings are present there and therefore ignored, helping users understand why those settings have no effect after the v11 behavior change.

Changes:

  • Add detection of disallowed keys in global config.yaml and push a warning listing ignored keys and the config file path.
  • Add a unit test ensuring the warning includes ignored keys/path and does not include allowed keys.
  • Add a changeset announcing the new warning behavior.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
config/reader/src/index.ts Collects and warns about keys ignored from global config.yaml before applying allowed settings.
config/reader/test/index.ts Adds coverage verifying the warning content and that ignored keys don’t affect resolved config.
.changeset/warn-ignored-global-settings.md Publishes the behavior change as a patch update.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread config/reader/src/index.ts
@zkochan zkochan merged commit 42378d0 into main May 5, 2026
17 checks passed
@zkochan zkochan deleted the ignore-global-settings branch May 5, 2026 16:58
zkochan added a commit that referenced this pull request May 5, 2026
- pnpm v11 silently drops local-only settings (e.g. `nodeLinker`, `hoistPattern`, `linkWorkspacePackages`) when they appear in the global `config.yaml`. Users had no way to tell their global configuration was being ignored.
- The reader now emits a warning that names the ignored keys and the path of the global config file, and directs users to either move the settings to a project-level `pnpm-workspace.yaml` or share them across projects via [config dependencies](https://pnpm.io/11.x/config-dependencies).
- Allowed keys (e.g. `dangerouslyAllowAllBuilds`, proxy settings) continue to be accepted with no warning.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

allowedDeprecatedVersions undefined when configured in global config.yaml file

2 participants