Skip to content

[Bug]: jsx-newline still considering comments with { "prevent": true, "allowMultilines": true } #3526

Open
@bryanhaney-shipengine

Description

@bryanhaney-shipengine

Is there an existing issue for this?

  • I have searched the existing issues and my issue is unique
  • My issue appears in the command-line and not only in the text editor

Description Overview

Per #3493, this has been reported as fixed, but I am still seeing Multiline JSX elements should start in a new line when a comment is above a multiline JSX block.

  • config:
    "react/jsx-newline": ["warn", { "allowMultilines": true, "prevent": true }],

  • example of invalid code:

{/* fake-eslint-disable-next-line react/forbid-component-props */}
<div>
  <p>Cool Beans</p>
  <p>Sweet</p>
</div>
  • example of code that passes:
{/* fake-eslint-disable-next-line react/forbid-component-props */}
<div>Cool Beans</div>

Expected Behavior

Comments above multiline JSX blocks should be ignored if jsx-newline is enabled with config options: { "prevent": true, "allowMultilines": true }

I expect this code to pass:

{/* fake-eslint-disable-next-line react/forbid-component-props */}
<div>
  <p>Cool Beans</p>
  <p>Sweet</p>
</div>

eslint-plugin-react version

v7.32.1

eslint version

v8.28.0

node version

v17.9.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions