Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix: respect negatedDescription for flags from schema (#3102)
  • Loading branch information
snitin315 committed Jan 24, 2022
1 parent 8bb55fb commit 463b731
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/webpack-cli/lib/webpack-cli.js
Expand Up @@ -402,6 +402,7 @@ class WebpackCLI {

if (option.configs) {
let needNegativeOption = false;
let negatedDescription;
const mainOptionType = new Set();

option.configs.forEach((config) => {
Expand All @@ -413,6 +414,7 @@ class WebpackCLI {
case "boolean":
if (!needNegativeOption) {
needNegativeOption = true;
negatedDescription = config.negatedDescription;
}

mainOptionType.add(Boolean);
Expand Down Expand Up @@ -449,6 +451,7 @@ class WebpackCLI {

if (!needNegativeOption) {
needNegativeOption = hasFalseEnum;
negatedDescription = config.negatedDescription;
}

return enumTypes;
Expand All @@ -467,9 +470,8 @@ class WebpackCLI {
if (needNegativeOption) {
negativeOption = {
flags: `--no-${option.name}`,
description: option.negatedDescription
? option.negatedDescription
: `Negative '${option.name}' option.`,
description:
negatedDescription || option.negatedDescription || `Negative '${option.name}' option.`,
};
}
} else {
Expand Down

0 comments on commit 463b731

Please sign in to comment.