Skip to content

Commit

Permalink
Yarn config respect --no-defaults with --json (fixes yarnpkg#6341)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
sparrowt authored Dec 17, 2024
1 parent 8bfe2d5 commit fc2bf0f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/plugin-essentials/sources/commands/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ export default class ConfigCommand extends BaseCommand {

if (this.json) {
for (const name of names) {
if (this.noDefaults && !configuration.sources.has(name))
continue;

const data = configuration.settings.get(name);
if (typeof data === `undefined`)
report.reportError(MessageName.INVALID_CONFIGURATION_KEY, `No configuration key named "${name}"`);
Expand Down

0 comments on commit fc2bf0f

Please sign in to comment.