Skip to content
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

jsx-wrap-multilines option for always newlining #1328

Closed
planttheidea opened this issue Jul 27, 2017 · 3 comments
Closed

jsx-wrap-multilines option for always newlining #1328

planttheidea opened this issue Jul 27, 2017 · 3 comments

Comments

@planttheidea
Copy link

There are a few other issues related to this concept, where the autofix for jsx-wrap-multilines results in something like this:

return (<div>
  foo
</div>);

This happens in specific scenarios (when there is no indentation set), but this always happens with multiline self-closing tags:

return (<SomeChildlessComponent
  foo="foo"
  bar="bar"
/>);

It would be really handy if there was an option added to jsx-wrap-multiline that always newlined the wrapped output on autofix, so that tag alignment was maintained:

return (
  <SomeChildlessComponent
    foo="foo"
    bar="bar"
  />
);

Since the whole point is that wrapping the element enhances readability, this option would help greatly.

@jseminck
Copy link
Contributor

I believe this was already requested here: #1207 (comment)

Although that comment is a bit hidden...

@ljharb
Copy link
Member

ljharb commented Nov 18, 2017

Does #1475 cover this?

@jseminck
Copy link
Contributor

jseminck commented Nov 18, 2017

I think it does. Given the right configuration. The rule is quite complex now (many options) but it's also really powerful. 😄

See example below, using autofixer on save + jsx-ident rule. Not sure why hello world does not get indented, but that's not part of this rule but jsx-indent instead.

jsx-wrap-multilines

@ljharb ljharb closed this as completed Nov 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants