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

Question about jsx-child-element-spacing logic and <br/> tags #2988

Closed
pascalpp opened this issue May 18, 2021 · 2 comments
Closed

Question about jsx-child-element-spacing logic and <br/> tags #2988

pascalpp opened this issue May 18, 2021 · 2 comments

Comments

@pascalpp
Copy link
Contributor

A couple examples:

  return (
    <div className="break-tag-example">
      one line
      <br/>
      another line
    </div>
  );
  return (
    <div className="break-tag-example">
      one line<br/>
      another line
    </div>
  );

Both of these are flagged for ambiguous spacing by jsx-child-element-spacing. But it seems in both cases the intent is clear and both would render as expected in the browser. I wonder if there could be some exception made for <br/> tags?

@ljharb
Copy link
Member

ljharb commented May 18, 2021

I would definitely expect the first example to be acceptable.

@pascalpp
Copy link
Contributor Author

@ljharb I've opened PR #2989 which simply removes BR from the set of inline elements, because I don't think there's any case where whitespace around a br tag would result in a different result rendered in the browser. Can you have a look?

@ljharb ljharb closed this as completed in 9a140a5 May 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants