Skip to content

⭐️New: Add rule no-boolean-default #612

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

Merged
merged 8 commits into from
Feb 3, 2019

Conversation

privatenumber
Copy link
Contributor

@privatenumber privatenumber commented Oct 14, 2018

I haven't added documentation yet but I can add one if you guys like the rule.

The rule prevents Boolean props from having a default value. I put this under essential as it follows HTML standards of always defaulting boolean attributes to false. Otherwise, users would have to do :prop="false" to turn it off.

The rule has the following options:
'constructor' (default) enforces that Boolean props must use the constructor.
'no-default' allows a prop definition object, but enforces that the default property not be defined.
'default-fase' enforces that the default can be set but must be set to false.

Copy link
Member

@mysticatea mysticatea left a comment

Choose a reason for hiding this comment

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

Thank you for this PR!

I like this idea.
Go for it: I think that we will merge it in.

@privatenumber
Copy link
Contributor Author

Thank you @mysticatea I made the updates! Let me know if there's anything else I can do.

@privatenumber
Copy link
Contributor Author

@armano2 Oops I misread his comment to add the spread outside of the prop schema. I updated the PR, thanks for catching

@armano2
Copy link
Contributor

armano2 commented Oct 29, 2018

@hirokiosame thank you 👍

@michalsnik
Copy link
Member

@armano2 I updated this PR, please take a look one more time :)

@privatenumber
Copy link
Contributor Author

Looks great, thanks for the updates @michalsnik

@michalsnik michalsnik merged commit 617139e into vuejs:master Feb 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants