jsx-eslint / eslint-plugin-react

React-specific linting rules for ESLint
MIT License
9k stars 2.77k forks source link

[Bug]: `jsx-curly-brace-presence` doesn't trigger on strings containing a quote character #3795

Closed tylerlaprade closed 3 months ago

tylerlaprade commented 3 months ago

Is there an existing issue for this?

Description Overview

The curly braces are unnecessary here and should be reported by the rule. If the single quote is replaced with any other character, the rule does trigger.

<Foo
  bar={"'"}
/>

Expected Behavior

Report an error with a suggested fix to

<Foo
  bar="'"
/>

eslint-plugin-react version

4.3.1

eslint version

8.57.0

node version

20.14.12