Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: respect negatedDescription for flags from schema #3102

Merged
merged 3 commits into from Jan 24, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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