Skip to content

[bug] no-useless-fragment false positive when using   #1035

@michaelfaith

Description

@michaelfaith

Describe the bug

I found one case where the no-useless-fragment rule was incorrectly flagging a fragment that included both a single component accompanied by a  . After running the autofix, it left it in a state that resulted in parsing errors.

Original code

return (
  <>
    <SomeComponent />
    &nbsp;
  </>
);

"Fixed" code

return (
  <SomeComponent />
  &nbsp;
);

Reproduction

No response

Expected behavior

Should consider html entities when assessing whether a fragment is needed or not.

Platform and versions

Node 22.11
ESLint 9.22.0

Stack trace


Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Status: ReleasedThe issue has been releasedType: BugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions