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

New rule: jsx-space-before-trailing-slash #125

Closed
balthild opened this issue Nov 30, 2017 · 3 comments
Closed

New rule: jsx-space-before-trailing-slash #125

balthild opened this issue Nov 30, 2017 · 3 comments

Comments

@balthild
Copy link

Prefer <MyComponent /> than <MyComponent/>

XHTML species:

C.2. Empty Elements

Include a space before the trailing / and > of empty elements, e.g. <br />, <hr /> and <img src="karen.jpg" alt="Karen" />. Also, use the minimized tag syntax for empty elements, e.g. <br />, as the alternative syntax <br></br> allowed by XML gives uncertain results in many existing user agents.

@j13z
Copy link

j13z commented Mar 3, 2018

It would be nice to have the option to either enforce the presence or absence of whitespace before the closing /> (whatever your team can agree on).

I'd be happy to add this the to the #144 pull request, if you need help, @no23reason (you'd have to generalize the rule to something like jsx-self-closing-consistent-whitespace and add an option to the rule, as well as some new tests).

@no23reason
Copy link
Contributor

@j13z Thank you for the comment, however I don't really see the point of purposefully omitting the space. I know it is not needed I just don't know anyone would use the space eliminating version. The W3C recommends the space, Prettier will add it in as well, etc.

@jkillian
Copy link
Contributor

jkillian commented May 8, 2018

Merged via #144 / #164 and released in 3.6.0!

@j13z if we decide we do want to add that option, it should fit consistently with the current rule name. (The rule controls the presence of the space before the closing of the tag, the name, to me, doesn't specifically need to mean that a space must be present)

@jkillian jkillian closed this as completed May 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants