Skip to content

Require JSX closing bracket to be aligned with the opening tag (react/jsx-closing-bracket-location) #1361

@feross

Description

@feross

This rule checks all JSX multiline elements and verifies the location of the closing bracket. By default this one must be aligned with the opening tag.

https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-closing-bracket-location.md

// ok
<Hello
  firstName="John"
  lastName="Smith"
/>;

// ok
<Say
  firstName="John"
  lastName="Smith"
>
  Hello
</Say>;

// ok
var x = (
  <Hello
    firstName="John"
    lastName="Smith"
  />
)

// ok
var x = function() {
  return (
    <Say
      firstName="John"
      lastName="Smith"
    >
      Hello
    </Say>
  )
}

// not ok
<Hello
  firstName="John"
  lastName="Smith"
  />;

// not ok
<Say
  firstName="John"
  lastName="Smith">
  Hello
</Say>;

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Done

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions