Skip to content

[Bug]: jsx-no-leaked-render causes code to be incorrect by removing parentheses #3698

Closed
@dusanristic

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

I'm encountering an issue with a code transformation performed by the jsx-no-leaked-renderer.
Original condition: connection && (hasError || hasErrorUpdate).
Converted condition: (!!connection && hasError) || hasErrorUpdate.
These conditions are not identical and produce different results for various inputs. For example, it will return different values for false, any, and true (respectively). In the first case it will return false, in the second it will return true.

Despite a reported issue and a pull request aimed at fixing this problem over a year ago, I'm still experiencing the same issue.
Am I missing something, or this is a bug?

Expected Behavior

I want to preserve original condition, or if it is converted, to be identical as original.

eslint-plugin-react version

v18.2.0

eslint version

v8.43.0

node version

v18.17.1

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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