-
-
Notifications
You must be signed in to change notification settings - Fork 681
⭐️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
Conversation
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.
Thank you for this PR!
I like this idea.
Go for it: I think that we will merge it in.
Thank you @mysticatea I made the updates! Let me know if there's anything else I can do. |
@armano2 Oops I misread his comment to add the spread outside of the prop schema. I updated the PR, thanks for catching |
@hirokiosame thank you 👍 |
@armano2 I updated this PR, please take a look one more time :) |
Looks great, thanks for the updates @michalsnik |
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 thedefault
property not be defined.'default-fase'
enforces that the default can be set but must be set tofalse
.