Error on unsupported flags for individual CLI commands#1889
Error on unsupported flags for individual CLI commands#1889Andarist merged 8 commits intochangesets:mainfrom
Conversation
🦋 Changeset detectedLatest commit: 5cdc4a9 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1889 +/- ##
==========================================
- Coverage 84.57% 84.24% -0.33%
==========================================
Files 55 56 +1
Lines 2399 2419 +20
Branches 726 723 -3
==========================================
+ Hits 2029 2038 +9
- Misses 364 375 +11
Partials 6 6 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| (key) => key !== "_" && !knownFlags.has(key) | ||
| ); | ||
|
|
||
| if (unknownFlags.length > 0) { |
There was a problem hiding this comment.
ugh, I'd love to just migrate away from mri to something that would handle such things for us, something that would also provide us with better type-safety.
@beeequeue would you maybe have any recommendations for an alternative?
There was a problem hiding this comment.
i can also recommend possibly changing the config parsing to use valibot, it would be easier to maintain in the long run, and if we make sure to bundle it it would also be very small.
valibot is 2MB to install since it has many types and checks, but treeshakes extremely well.
5c018c4 to
ed7ea4f
Compare
ed7ea4f to
7225497
Compare
* fix(cli): warn when unknown flags are passed * refactor * strip aliases * fix mri annoying mutation * validate init too * remove redundant `gitTag` default that got in a way * add changeset --------- Co-authored-by: Maks Pikov <mixelburg@users.noreply.github.com> Co-authored-by: Mateusz Burzyński <mateuszburzynski@gmail.com>
Fixes #1827
Currently the CLI silently ignores any flag it doesn't recognise and proceeds to run the command. This can lead to confusing behaviour — e.g. a typo in
--otpsilently results in publishing without an OTP.This PR adds a warning printed via
@changesets/loggerwhenevermrisurfaces a parsed flag that isn't in the known set:Multiple unknown flags are collected and shown together:
The known set includes all declared boolean/string flags, their alias canonical names, the deprecated v1 flags (
updateChangelog,isPublic,skipCI,commit) that already have their own error path inrun.ts, and the built-inhelp/versionflags.