You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello there, it would be nice to have the option in the react/jsx-curly-spacing rule to specify whether spaces should be added for props that are spread.
This is what I would like:
<CustomComp prop1={{ key1: value1 }} prop2={value2} /> // if JSX attributes are not spread props, then remove spaces
<CustomComp { ...{ prop3, prop4 } } /> // if JSX attributes are spread props, then add spaces
<CustomComp prop1={{ key1: value1 }} prop2={value2} { ...{ prop3, prop4 } } />
If I set the rule to this:
'react/jsx-curly-spacing': [ 'error', 'always' ]
Then, my code is formatted into this:
<CustomComp prop1={ { key1: value1 } } prop2={ value2 } /> // spaces added for props that are not spread
<CustomComp { ...{ prop3, prop4 } } /> // spaces added for props that are spread
But if I set the rule to this:
'react/jsx-curly-spacing': [ 'error', 'never' ]
Then, my code is formatted into this:
<CustomComp prop1={{ key1: value1 }} prop2={value2} /> // spaces removed for props that are not spread
<CustomComp {...{ prop3, prop4 }} /> // spaces removed for props that are spread
Yes, I know that Airbnb's style guide requires that the spaces be omitted for all props, including spread props, and so I'm proposing giving the option to making an exception for when the props are spread.
Hello there, it would be nice to have the option in the react/jsx-curly-spacing rule to specify whether spaces should be added for props that are spread.
This is what I would like:
If I set the rule to this:
Then, my code is formatted into this:
But if I set the rule to this:
Then, my code is formatted into this:
Yes, I know that Airbnb's style guide requires that the spaces be omitted for all props, including spread props, and so I'm proposing giving the option to making an exception for when the props are spread.
Maybe it could look something like this?
Could this option be added, pretty please? It's my birthday today 🥺
The text was updated successfully, but these errors were encountered: