jsx-closing-bracket-location
Configuration
Rule Details
Enforces the closing bracket location for JSX multiline elements. By default the closing bracket must be aligned with the opening tag.
Examples of incorrect code for this rule:
Examples of correct code for this rule:
Rule Options
There are two ways to configure this rule.
The first form is a string shortcut corresponding to the location values specified below. If omitted, it defaults to "tag-aligned".
The second form allows you to distinguish between non-empty and self-closing tags. Both properties are optional, and both default to "tag-aligned". You can also disable the rule for one particular type of tag by setting the value to false.
location
Enforced location for the closing bracket.
tag-aligned: must be aligned with the opening tag.line-aligned: must be aligned with the line containing the opening tag.after-props: must be placed right after the last prop.props-aligned: must be aligned with the last prop.
Defaults to tag-aligned.
For backward compatibility, you may pass an object { "location": <location> } that is equivalent to the first string shortcut form.
Examples of incorrect code for this rule with "tag-aligned" (default) or "line-aligned":
Examples of incorrect code for this rule with "after-props":
Examples of incorrect code for this rule with "props-aligned":
Examples of correct code for this rule with "tag-aligned" (default) or "line-aligned":
Examples of correct code for this rule with { "selfClosing": "after-props" }:
Examples of correct code for this rule with { "selfClosing": "props-aligned", "nonEmpty": "after-props" }:
When Not To Use It
If you are not using JSX, you can disable this rule.