Skip to content

jsx-newline puts line breaks between comments and new JSX elements #3478

Closed
@Sreejit7

Description

@Sreejit7

I have the jsx-newline rule turned on, which when run with the --fix option, puts line breaks between any comments (including eslint-disable comments) and JSX elements, thus undoing the whole point of using comments.

Let's say I have something like this:

<Element as="header" marginBottom="micro">
        {/* eslint-disable-next-line react/jsx-sort-props */}
        <Heading as="h6" align="right">
            Transaction value
        </Heading>
<Element>

The jsx-newline rule puts a line break between the eslint-disable comment and , therefore causing the eslint-disable-{some rule} to stop working.

Can we handle putting line breaks between comments & new JSX elements?

I saw something similar in #2926 (which was closed earlier as completed) but that doesn't work properly as of v7.31.10

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