-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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: Control empty lines around JSX tags #2793
Comments
Thanks @ljharb , that issue and PR appear to add lines with no configuration options. My goal is the opposite. The PR looks like good work though. I would not want to impede it by asking for more. |
@jsphstls after that PR, can you help me understand what would you still be unable to do? |
@ljharb I would be unable to automatically remove extra lines around and between JSX elements. Invalid:
Valid:
|
I see - so essentially, that PR adds jsx-newline which by default ensures lines, and you’d like a configuration option that removes them? That seems like a reasonable option to add, either directly to that PR or as a follow up. Would you be interested? |
Sure, I can try it after that merge. |
@jsphstls Did you make progress on this? |
@lukasgjetting thank for the reminder. I am working on the MR to make this rule reversible. However, I am seeing some odd behaviour with the presence of |
I'd like a rule that would help eliminate empty lines around JSX. The most common case that I encounter is the above example when empty lines occur (mostly after) the JSX and before a closing parenthesis. I don't think these are ever done intentionally and I cannot see how it would improve readability.
A related case that is less common is to add blank lines between JSX:
This is often done intentionally. I am less concerned about these cases. However, I think they create ambiguity around whether those line breaks are intended to render. I also think that any component that requires spacing within the JSX should be simplified.
I did pursue a way to fix this without this plugin via
padding-line-between-statements
but since Eslint core no longer takes styling changes I was bounced over here.The text was updated successfully, but these errors were encountered: