Skip to content

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

Open
@stevensacks

Description

@stevensacks

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

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

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