Skip to content

fix(@angular/cli): define option is being included multiple times in the JSON help #30746

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

Merged
merged 1 commit into from
Jul 21, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -64,23 +64,25 @@ export function jsonHelpUsage(localYargs: Argv): string {
const descriptions = usageInstance.getDescriptions();
const groups = localYargsInstance.getGroups();
const positional = groups[usageInstance.getPositionalGroupName()] as string[] | undefined;

const seen = new Set<string>();
const hidden = new Set(hiddenOptions);
const normalizeOptions: JsonHelpOption[] = [];
const allAliases = new Set([...Object.values<string[]>(aliases).flat()]);

// Reverted order of https://github.com/yargs/yargs/blob/971e351705f0fbc5566c6ed1dfd707fa65e11c0d/lib/usage.ts#L419-L424
for (const [names, type] of [
[number, 'number'],
[array, 'array'],
[string, 'string'],
[boolean, 'boolean'],
[number, 'number'],
]) {
for (const name of names) {
if (allAliases.has(name) || hidden.has(name)) {
if (allAliases.has(name) || hidden.has(name) || seen.has(name)) {
// Ignore hidden, aliases and already visited option.
continue;
}

seen.add(name);
const positionalIndex = positional?.indexOf(name) ?? -1;
const alias = aliases[name];

Expand Down