fix(config): warn on ignored settings in global config.yaml#11470
Conversation
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.
📝 WalkthroughWalkthroughpnpm now warns users when disallowed global settings (e.g., ChangesGlobal Config Validation with Warnings
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Drop the .npmrc suggestion (pnpm only reads auth and network keys from .npmrc) and point users to config dependencies for sharing settings across projects.
There was a problem hiding this comment.
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.yamland 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.
- 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
Summary
nodeLinker,hoistPattern,linkWorkspacePackages) when they appear in the globalconfig.yaml. Users had no way to tell their global configuration was being ignored.pnpm-workspace.yamlor share them across projects via config dependencies.dangerouslyAllowAllBuilds, proxy settings) continue to be accepted with no warning.close #11429
Test plan
pnpm --filter @pnpm/config.reader run compile— typecheck and lint passconfig/reader/test/index.tswrites a globalconfig.yamlmixing 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 usepnpm-workspace.yaml, and the link to config-dependencies docs (and does not mention.npmrc)global config.yamltests still pass