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

Require JSX closing bracket to be aligned with the opening tag (react/jsx-closing-bracket-location) #1361

Closed
feross opened this issue Aug 14, 2019 · 1 comment

Comments

@feross
Copy link
Member

commented Aug 14, 2019

This rule checks all JSX multiline elements and verifies the location of the closing bracket. By default this one must be aligned with the opening tag.

https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-closing-bracket-location.md

// ok
<Hello
  firstName="John"
  lastName="Smith"
/>;

// ok
<Say
  firstName="John"
  lastName="Smith"
>
  Hello
</Say>;

// ok
var x = (
  <Hello
    firstName="John"
    lastName="Smith"
  />
)

// ok
var x = function() {
  return (
    <Say
      firstName="John"
      lastName="Smith"
    >
      Hello
    </Say>
  )
}

// not ok
<Hello
  firstName="John"
  lastName="Smith"
  />;

// not ok
<Say
  firstName="John"
  lastName="Smith">
  Hello
</Say>;

@feross feross added this to the standard 14 milestone Aug 14, 2019

@feross

This comment has been minimized.

Copy link
Member Author

commented Aug 14, 2019

This codifies my personal style preference. I prefer the parallelism and how the alignment makes it really clear where the tag ends. Using this style already on bitmidi.com and webtorrent-deskop.

Shipping in standard 14.

@feross feross closed this in f8551e9 Aug 14, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
1 participant
You can’t perform that action at this time.