Skip to content

Commit 463b731

Browse files
authored
fix: respect negatedDescription for flags from schema (#3102)
1 parent 8bb55fb commit 463b731

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

packages/webpack-cli/lib/webpack-cli.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,7 @@ class WebpackCLI {
402402

403403
if (option.configs) {
404404
let needNegativeOption = false;
405+
let negatedDescription;
405406
const mainOptionType = new Set();
406407

407408
option.configs.forEach((config) => {
@@ -413,6 +414,7 @@ class WebpackCLI {
413414
case "boolean":
414415
if (!needNegativeOption) {
415416
needNegativeOption = true;
417+
negatedDescription = config.negatedDescription;
416418
}
417419

418420
mainOptionType.add(Boolean);
@@ -449,6 +451,7 @@ class WebpackCLI {
449451

450452
if (!needNegativeOption) {
451453
needNegativeOption = hasFalseEnum;
454+
negatedDescription = config.negatedDescription;
452455
}
453456

454457
return enumTypes;
@@ -467,9 +470,8 @@ class WebpackCLI {
467470
if (needNegativeOption) {
468471
negativeOption = {
469472
flags: `--no-${option.name}`,
470-
description: option.negatedDescription
471-
? option.negatedDescription
472-
: `Negative '${option.name}' option.`,
473+
description:
474+
negatedDescription || option.negatedDescription || `Negative '${option.name}' option.`,
473475
};
474476
}
475477
} else {

0 commit comments

Comments
 (0)