-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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 tag to be aligned with the opening tag (react/jsx-closing-tag-location) #1358
Comments
I know this is not controversial so I am going to ship it in |
@feross Doesn't this collide with indent/jsx-indent rule? |
@MatanBobi I don't believe so. Can you explain how? |
@feross I think that @MatanBobi means using non-self-closing tag with return:
With this rule, this style raises an error (not aligned to open tag) and if I try to
which raises The only way to fix it is putting all in one line:
but is not really sustainable. |
@joke2k The intended style is to add parens anytime you have a multiline JSX statement. render () {
return (
<div>
Closing tag below where should be?
</div>
)
} I'm not sure why the autofixer isn't doing that for you. Looks like we need to play with the JSX rules some more to get what we want. |
Re-opening so we can investigate fixing this for |
@joke2k You got exactly what I meant, thanks for the wide explanation. |
I believe this is fixed in |
…-closing-tag-location) Fixes: standard/standard#1358
…-closing-tag-location) Fixes: standard/standard#1358
This rule checks all JSX multiline elements with children (non-self-closing) and verifies the location of the closing tag. The expectation is that the closing tag is aligned with the opening tag on its own line.
https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-closing-tag-location.md
The following patterns are considered warnings:
The following are not considered warnings:
The text was updated successfully, but these errors were encountered: