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
Correctly set default options for boolean flags #72
Conversation
Codecov Report
@@ Coverage Diff @@
## master #72 +/- ##
=====================================
Coverage 100% 100%
=====================================
Files 3 3
Lines 103 103
=====================================
Hits 103 103 Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, thank you!
@@ -112,10 +114,10 @@ const parser = yargs | |||
- true - Example: { foo: bar } | |||
- false - Example: {foo: bar} | |||
`, | |||
choices: [true, false], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't make much sense when I added it in the previous commit. It's encouraged to be used as either --semi
or --no-semi
. Furthermore, yargs complains that undefined
is not a valid choice (true
or false
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, cool! 👍
Thank you! |
See #71.
This is a follow-up to #63 where I removed the default values for some boolean flags (
semi
,use-tabs
,bracket-spacing
,jsx-bracket-same-line
,single-quote
).yargs still sets the default value to
false
if the option is not present. This PR sets the default value toundefined
as per the documentation.