Skip to content

Airbnb guidelines for auto-closing tag sequence alignment break indentation #149

@tymarats

Description

@tymarats

Airbnb guidelines for alignment of React auto-closing tags (https://github.com/airbnb/javascript/tree/master/react#alignment) breaks indentation, as in the following example

export default <cx>
    <MyComponent
        that={1}
        has={2}
        closing={3}
        tag={4}
        in={5}
        new={6}
        line={7}
    />

<OtherComponent
    should={1}
    be={2}
    indented={3}
/>
    </cx>

while this one works fine:

/* Ok indentation */
export default <cx>
    <MyComponent
        that={1}
        has={2}
        closing={3}
        tag={4}
        in={5}
        same={6}
        line={7} />

    <OtherComponent
        indents={1}
        ok={2} />
</cx>

This seems to happen only in cases when there is an empty line between the auto-closing tag sequence and the next tag, so this seems to work fine:

export default <cx>
    <MyComponent
        that={1}
        has={2}
        closing={3}
        tag={4}
        in={5}
        new={6}
        line={7}
    />
    <OtherComponent
        indents={1}
        ok={2}
    />
</cx>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions