Skip to content
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

Merged
merged 1 commit into from Jun 7, 2017

Conversation

mrm007
Copy link
Contributor

@mrm007 mrm007 commented Jun 7, 2017

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 to undefined as per the documentation.

@codecov-io
Copy link

codecov-io commented Jun 7, 2017

Codecov Report

Merging #72 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@          Coverage Diff          @@
##           master    #72   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files           3      3           
  Lines         103    103           
=====================================
  Hits          103    103

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8ff62ab...034dc5b. Read the comment docs.

Copy link
Member

@kentcdodds kentcdodds left a 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],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this change?

Copy link
Contributor Author

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).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, cool! 👍

@kentcdodds kentcdodds merged commit dbcf8ed into prettier:master Jun 7, 2017
@kentcdodds
Copy link
Member

Thank you!

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.

None yet

3 participants