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

Validate whitespace in and around the JSX opening and closing brackets (jsx-tag-spacing) #697

Closed
feross opened this issue Nov 22, 2016 · 3 comments

Comments

@feross
Copy link
Member

commented Nov 22, 2016

Enforce or forbid spaces after the opening bracket, before the closing bracket of self-closing elements, and between the angle bracket and slash of JSX closing or self-closing elements.

{
  "closingSlash": "never",
  "beforeSelfClosing": "always",
  "afterOpening": "never"
}

https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-tag-spacing.md

(Also, remove the deprecated jsx-space-before-closing rule which is already enabled, but superceded by jsx-tag-spacing which is more complete)

@feross feross added the enhancement label Nov 22, 2016

@cpsubrian

This comment has been minimized.

Copy link

commented Dec 8, 2016

Just updated and noticed that <TagName attr='value'/> is not allowed anymore. Personally I find that more readable than <TagName attr='value' />, especially in the context of indenting where the /> feels like its hanging out in the middle of nowhere.

<Wrapper>
  <TagName attr='value' />
</Wrapper>

Also it seems inconsistent to then allow <TagName attr='value></TagName>
Shouldn't it be <TagName attr='value' ></TagName>

@dcousens

This comment has been minimized.

Copy link
Member

commented Dec 8, 2016

The hanging space did seem a bit odd, agreed with @cpsubrian . I personally hadn't thought about it.

edit: Actually, it seems like it is an XML convention

@feross feross added this to the standard v11 milestone Apr 4, 2017

@feross feross modified the milestones: standard v12, standard v13 Aug 28, 2018

@feross feross modified the milestones: standard v13, standard v14 Jul 5, 2019

@feross

This comment has been minimized.

Copy link
Member Author

commented Aug 14, 2019

This has actually been fixed for a while. Not sure what version it shipped in, but there's nothing to do here.

@feross feross closed this Aug 14, 2019

@feross feross removed this from the standard 14 milestone Aug 14, 2019

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