-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Add option to the self-closing-comp #600
Conversation
|
||
## Rule Options | ||
|
||
It takes an option as the second parameter, which corresponding what components tags should be self-closed when this is possible. |
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.
We should indicate which is the default here - "component" i think.
```js | ||
... | ||
"self-closing-comp": [<enabled>, { | ||
"component" <boolean> || true, |
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.
|| true
means it will never be false, so i don't think this is good notation. I'd just provide the default object:
"self-closing-comp": ["error", {
"component": true,
"html": false
}]
I think it's pretty self-apparent that you can override them with your own booleans
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, fixed
Just to be safe, could we also add tests with the options object omitted? |
Yes, sure. Just copied all tests without options and pasted with adding |
LGTM but i'll let @yannickcr do the merging since i'm pretty weak on parser code |
@yannickcr, are there any plans to release this fix? |
@gitim Yes, but I'm currently in holidays and this until the 1st June, then I will be at React Europe on 2-3 June. So do not expect a lot of activity from me until the 4th June. |
Thanks! |
This pr adds an option to the self-closing-comp suggested #572, which is corresponding what type of tags (
{component: <boolean>, html: <boolean>}
) should be self-closed when this is possible. Note: this not changes current behavior, default option is{component: true, html: false}
, but in the next majorrelease we can change it to
{component: true, html: true}
to enforce all tags to be self-closing when that is possible.