Skip to content

Commit

Permalink
Fix ignored package.json config when using the CLI (#520)
Browse files Browse the repository at this point in the history
Co-authored-by: Sindre Sorhus <sindresorhus@gmail.com>
  • Loading branch information
dersimn and sindresorhus committed Feb 20, 2021
1 parent 2e05c81 commit 32bd3b8
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions cli-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,15 @@ updateNotifier({pkg: cli.pkg}).notify();

const {input, flags: options, showVersion} = cli;

// TODO: Fix this properly instead of the below workaround.
// Revert behavior of meow >8 to pre-8 (7.1.1) for flags using `isMultiple: true`.
// Otherwise, options defined in package.json can't be merged by lib/options-manager.js `mergeOptions()`.
for (const key in options) {
if (Array.isArray(options[key]) && options[key].length === 0) {
delete options[key];
}
}

// Make data types for `options.space` match those of the API
// Check for string type because `xo --no-space` sets `options.space` to `false`
if (typeof options.space === 'string') {
Expand Down

0 comments on commit 32bd3b8

Please sign in to comment.