Skip to content

[Bug]: Excessive code changes done by --fix react/jsx-no-leaked-render #3551

Closed
@gersongoulart

Description

@gersongoulart

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

When using 'react/jsx-no-leaked-render': ['error', { validStrategies: ['coerce', 'ternary'] }], and running eslint --fix the resulting code changes go beyond what's required for the actual fix by also removing parentheses, causing excessive code diffs.

Screenshot 2023-03-17 at 9 03 07 PM

I would expect the second hunk to be a single line change, just like the first hunk. Running this fix across a large codebase is unfeasible because the changes cannot be human-verified.

eslint --fix with 'react/jsx-no-leaked-render': ['error', { validStrategies: ['coerce', 'ternary'] }],

Expected Behavior

I'd expect no parentheses would be removed and no code-style to change. Other than the !! required to fix the issue, nothing else at all should change in the code.

Screenshot 2023-03-17 at 9 09 34 PM

eslint-plugin-react version

7.21.5

eslint version

8.35.0

node version

16.13.1

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions