preact-cli icon indicating copy to clipboard operation
preact-cli copied to clipboard

Using incorrect/invalid types for CLI flags raises no warnings to user and is passed through as-is, which can result in unexpected behavior

Open peterbe opened this issue 4 years ago • 1 comments

Originally posted by @rschristian in https://github.com/preactjs/preact-cli/issues/1596#issuecomment-938123047

Typing preact watch -p XXXX just goes ahead and starts on the default port (8080). It should error because XXXX is not a number.

peterbe avatar Oct 07 '21 20:10 peterbe

To expound a bit: most args don't have any type validation and rely upon fallbacks or (sometimes) questionable coercion deep into the tool. Warnings aren't raised to the user on such occasions and our assumptions about types can sometimes be faulty (see #1595).

Just wanted to clarify that this isn't just an issue with the port, but many of our arguments. They should all get the same treatment (eventually).

rschristian avatar Oct 07 '21 20:10 rschristian