-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Proposal: Linting for missing spaces between tags #1515
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
Comments
I don't think a rule could catch this, because there's no guarantee that the user wants the space there - and in fact, they might not want it. That's why the best practice is to be explicit. |
In my experience, it is very rare that the developer does not want the space. It is almost always indicative of an error that manifests as incorrectly rendered copy In the case where the developer does not want the space, I would consider it reasonable to require that they be directly adjacent, as in
Or when the line is long
In general, as written originally the developer's intent is not clear. It appears as though they want some whitespace between the tags, but they may not One could imagine a rule that forces you to be explicit always - that is, including |
It might not be safely autofixable at least; but sure, it'd be interesting to see the test cases in a PR. |
Thanks - I added some illustrative test cases in #1519 |
If your React markup looks like this:
The whitespace will be collapsed and it will look like
Note that the whitespace is collapsed. The recommended solution from React is to write your code as
which will render correctly.
It would be great if there was a lint rule that caught this.
The text was updated successfully, but these errors were encountered: