Skip to content

New rule: Control empty lines around JSX tags #2793

Closed
@jsphstls

Description

@jsphstls
return (

  <button/>

)

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:

return (
  <div> 
    <button/>

    <button/>
  </div>
)

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions