jsx-eslint/eslint-plugin-react

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

Open

#3,908 建立於 2025年3月21日

在 GitHub 查看
 (2 留言) (5 反應) (0 負責人)JavaScript (8,630 star) (2,797 fork)batch import
enhancementhelp wantedtypescript

描述

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

貢獻者指南

[Bug]: react/jsx-no-leaked-render reports error on boolean values and tries to convert them · jsx-eslint/eslint-plugin-react#3908 | Good First Issue