Skip to content

fix: reject blank numeric CLI values#1224

Merged
tw93 merged 1 commit into
tw93:mainfrom
Ghraven:fix/reject-blank-numeric-options
Jun 15, 2026
Merged

fix: reject blank numeric CLI values#1224
tw93 merged 1 commit into
tw93:mainfrom
Ghraven:fix/reject-blank-numeric-options

Conversation

@Ghraven

@Ghraven Ghraven commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

What changed

  • Reject empty or whitespace-only values in the shared numeric CLI validator.
  • Added a regression test for blank numeric values.
  • Rebuilt dist/cli.js so the published CLI bundle matches the source change.

Problem

validateNumberInput() used Number(value) directly. In JavaScript, Number("") and Number(" ") both evaluate to 0, so blank input could be accepted as a valid numeric value for options using this shared validator, such as --min-width and --min-height.

Before / after

Before:

  • validateNumberInput("") returned 0.
  • validateNumberInput(" ") returned 0.

After:

  • Blank or whitespace-only numeric values throw InvalidArgumentError("Not a number.").
  • Existing valid values like 1200 and 0 keep working.

Verification

  • corepack pnpm exec vitest run tests/unit/cli-options.test.ts → 9 tests passed.
  • corepack pnpm run cli:build completed successfully and regenerated dist/cli.js.
  • git diff --check passes.

@tw93 tw93 merged commit e68dc9e into tw93:main Jun 15, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants