Skip to content

Commit 32bd3b8

Browse files
dersimnsindresorhus
andauthoredFeb 20, 2021
Fix ignored package.json config when using the CLI (#520)
Co-authored-by: Sindre Sorhus <sindresorhus@gmail.com>
1 parent 2e05c81 commit 32bd3b8

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed
 

Diff for: ‎cli-main.js

+9
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,15 @@ updateNotifier({pkg: cli.pkg}).notify();
116116

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

119+
// TODO: Fix this properly instead of the below workaround.
120+
// Revert behavior of meow >8 to pre-8 (7.1.1) for flags using `isMultiple: true`.
121+
// Otherwise, options defined in package.json can't be merged by lib/options-manager.js `mergeOptions()`.
122+
for (const key in options) {
123+
if (Array.isArray(options[key]) && options[key].length === 0) {
124+
delete options[key];
125+
}
126+
}
127+
119128
// Make data types for `options.space` match those of the API
120129
// Check for string type because `xo --no-space` sets `options.space` to `false`
121130
if (typeof options.space === 'string') {

0 commit comments

Comments
 (0)
Please sign in to comment.