Skip to content

Commit

Permalink
fix: respect negatedDescription for flags from schema (#3102)
Browse files Browse the repository at this point in the history
  • Loading branch information
snitin315 authored 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
Original file line number Diff line number Diff line change
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.