jsx-eslint/eslint-plugin-react

[Bug]: `react/jsx-newline` does not remove empty lines for surrounding tags

Open

#3 663 ouverte le 6 déc. 2023

Voir sur GitHub
 (2 commentaires) (0 réactions) (0 assignés)JavaScript (8 630 stars) (2 797 forks)batch import
enhancementhelp wanted

Description

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

react/jsx-newline with { "prevent": true } does not remove empty lines for surrounding tags.

Currently react/jsx-newline does not detect any lint errors for the following JSX:

<div>

  <span>
    hi
  </span>

</div>

Expected Behavior

The current detection feels like unintended behavior, as I would expect all newlines within JSX to be removed as follows:

<div>
  <span>
    hi
  </span>
</div>

If there is a different eslint rule that checks for this please let me know!

eslint-plugin-react version

v7.33.2

eslint version

v8.55.0

node version

v18.6.0

Guide contributeur