chore(commit): broaden flag-alias guard; drop redundant CommitOptions casts#1287
Merged
Conversation
… casts Two small cleanups surfaced by the 0.72.1 review. 1. flagAliasConsistency.test.ts previously guarded only the two reconciled flags (#1245). Broaden it to assert the structural invariant across all 13 command option maps: within any single command, no single-letter alias maps to two options (the condition that would make yargs throw). Cross-command letter reuse is intentional (e.g. `-b`), so it is deliberately not asserted. 2. generateCommitDraft.ts cast `argv.append as string | undefined` / `argv.appendTicket as boolean | undefined` — redundant since #1268 added those fields to `CommitOptions` (argv is `Arguments<CommitOptions>`, so the types are already exact). Dropped the casts; the handler already reads them un-cast.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two low-priority cleanups from the 0.72.1 review
Both flagged during the review sweep as non-bugs worth tidying.
1. Broaden the flag-alias regression guard
flagAliasConsistency.test.tsonly pinned the two reconciled flags from #1245. It now also asserts the structural invariant across all 13 command option maps: within any single command, no single-letter alias maps to two different options — the condition that makes yargs throw.Cross-command letter reuse (e.g.
-bmeaningbranchin some commands) is intentional and is deliberately not asserted. The new test passes today, confirming no command currently has a within-command short-flag collision.2. Drop redundant
CommitOptionscastsgenerateCommitDraft.tscastargv.append as string | undefined/argv.appendTicket as boolean | undefined. Since #1268 added those fields to theCommitOptionsinterface,argv(typedArguments<CommitOptions>) already carries the exact types — the whole point of that typing was to drop such casts (the handler already reads them un-cast). Removed.Validation
jestflag-alias + full commit suite: 9 suites / 145 tests pass ·tsc --noEmitclean ·eslint0 errors ·rollup -cbuilds.