Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: react/jsx-no-leaked-render reports error on boolean values and tries to convert them #3908

Open
2 tasks done
bytasv opened this issue Mar 21, 2025 · 1 comment
Open
2 tasks done

Comments

@bytasv
Copy link

bytasv commented Mar 21, 2025

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

Using following setup:

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

Image

The code reports error even though emptyCollection is already boolean value. I understand that the plugin does not take into account actual types that TS provides.

Running lint command reports an issue unless I convert the code to this 👇

Image

Is there a way to prevent this from being "fixed" since it's already a boolean value?

Expected Behavior

eslint-plugin-react version

v7.37.4

eslint version

v9.18.0

node version

v22.13.0

@ljharb
Copy link
Member

ljharb commented Mar 21, 2025

When the type information is available, it would be a fine enhancement to use it.

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

No branches or pull requests

2 participants