Skip to content

Commit fc2bf0f

Browse files
authored
Yarn config respect --no-defaults with --json (fixes yarnpkg#6341)
As documented here https://yarnpkg.com/cli/config you would expect `--no-defaults` to omit defaults even when `--json` is also specified. This commit fixes that behaviour to be as expected.
1 parent 8bfe2d5 commit fc2bf0f

File tree

1 file changed

+3
-0
lines changed
  • packages/plugin-essentials/sources/commands

1 file changed

+3
-0
lines changed

packages/plugin-essentials/sources/commands/config.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ export default class ConfigCommand extends BaseCommand {
7676

7777
if (this.json) {
7878
for (const name of names) {
79+
if (this.noDefaults && !configuration.sources.has(name))
80+
continue;
81+
7982
const data = configuration.settings.get(name);
8083
if (typeof data === `undefined`)
8184
report.reportError(MessageName.INVALID_CONFIGURATION_KEY, `No configuration key named "${name}"`);

0 commit comments

Comments
 (0)