jsx-wrap-multilines: option to exclude selfclosing components
#1 279 ouverte le 27 juin 2017
Métriques du dépôt
- Stars
- (8 630 stars)
- Métriques de merge PR
- (Aucune PR mergée en 30 j)
Description
Hi! We have a lot of selfclosing components that can be assigned to variables and have line break between attributes, like
const comp = <Component prop1='prop1' prop2='prop2' prop3='prop3'/
prop4='prop4' prop5='prop5'/>;
I don't want to wrap such components in parens, but want to wrap multiline components that have children
const comp = (
<Component prop1='prop1' prop2='prop2' prop3='prop3'/
prop4='prop4' prop5='prop5'>
<ChildrenComp/>
<ChildrenComp/>
<ChildrenComp/>
</Component>
);
Today jsx-wrap-multilines just enforce parens on any multiline components, would be great to have option to ignore selfclosing ones. And maybe each current option (declaration, assignment, return, arrow) should have such option, because, for instance, I might want to wrap returned multiline component into parens anyway
return (
<Component prop1='prop1' prop2='prop2' prop3='prop3'/
prop4='prop4' prop5='prop5'/>
);
So maybe config could look like
'react/jsx-wrap-multilines': [2, {
'declaration': {ignoreSelfClosing: true},
'assignment': {ignoreSelfClosing: true},
'return': true,
'arrow': true,
}],