eslint-plugin-react icon indicating copy to clipboard operation
eslint-plugin-react copied to clipboard

[Bug]: jsx-no-useless-fragment does not auto-fix in ESLInt 9

Open stevensacks opened this issue 4 months ago • 0 comments

Is there an existing issue for this?

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

Description Overview

In ESLint v8, it removes the useless fragment with --fix, as expected.

In ESLint v9, it doesn't remove it, it just tells you it's in violation.

This happens in both the CLI and the IDE (WebStorm/VSCode)

const Example = () => (
  <div>
    <>Hello</>
  </div>
);

error  Fragments should contain more than one child - otherwise, there’s no need for a Fragment at all  react/jsx-no-useless-fragment

It is only saying the error is there, it is not auto-fixing

npx eslint

Expected Behavior

It should auto-fix by removing the useless fragment

eslint-plugin-react version

7.37.5

eslint version

9.28.0

node version

22.15.0

stevensacks avatar Jun 12 '25 03:06 stevensacks