Skip to content

tsx formatter indents the closing bracket #11513

Description

@MastroLindus

TypeScript Version: stable 2.0.3

I am using a tslint rule shipped by palantir for checking tsx/jsx alignment, https://github.com/palantir/tslint-react.
The rule states that the closing bracket of an element should be aligned with the opening bracket, and I would argue that it is a sensible default for multiline tsx declarations.
However the tsx formatter at the moment is indenting the closing bracket as well, and it breaks the rule.

Code
Example with two divs (one self closing, one not)

<div
    id="test"
/>
<div
    id="test2
>
</div>

Expected behavior:
after format:

<div
    id="test"
/>
<div
    id="test2"
>
</div>

Actual behavior:
after format:

<div
    id="test"
    />
<div
    id="test2"
    >
</div>

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptDomain: FormatterThe issue relates to the built-in formatterFixedA PR has been merged for this issueHelp WantedYou can do this

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions