Skip to content

[Bug]: jsx-curly-brace-presence still warns on strings containing unescaped entities #3801

Open
@musjj

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

This commit: fe708e1 adds a special case that is supposed to allow plain string literals inside JSX expressions if it contains unescaped HTML entities:

<p>{`'`}</p>

Previously, the warning will yield the following invalid JSX when "fixed":

<p>'</p>

The issue still remains because the special case only considers strings quoted with backticks but not normal quotes

Related issue: #3214

Expected Behavior

This should not trigger a warning:

<p>{"'"}</p>

eslint-plugin-react version

v7.34.0

eslint version

v8.57.0

node version

v20.15.1

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions