Repository: jsx-eslint/eslint-plugin-react (js)

Issue:
[Bug]: `jsx-curly-brace-presence` doesn't trigger on strings containing a quote character
### Is there an existing issue for this?

- [X] I have searched the existing issues and my issue is unique
- [X] My issue appears in the command-line and not only in the text editor

### 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.
```jsx
<Foo
  bar={"'"}
/>
```

### Expected Behavior

Report an error with a suggested fix to
```jsx
<Foo
  bar="'"
/>
```

### eslint-plugin-react version

4.3.1

### eslint version

8.57.0

### node version

20.14.12

Pull request description:
[Fix] `jsx-curly-brace-presence`: do not trigger on strings containing a quote character
Fixes #3795

Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index a6aca8c4..98edcee2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,11 @@ This change log adheres to standards from [Keep a CHANGELOG](https://keepachange
 
 ## Unreleased
 
+### Fixed
+* [`jsx-curly-brace-presence`]: do not trigger on strings containing a quote character ([#3798][] @akulsr0)
+
+[#3798]: https://github.com/jsx-eslint/eslint-plugin-react/pull/3798
+
 ## [7.35.0] - 2024.07.19
 
 ### Added
diff --git a/lib/rules/jsx-curly-brace-presence.js b/lib/rules/jsx-curly-brace-presence.js
index 213e0ce3..cfbe3bda 100755
--- a/lib/rules/jsx-curly-brace-presence.js
+++ b/lib/rules/jsx-curly-brace-presence.js
@@ -269,7 +269,7 @@ module.exports = {
           && !containsMultilineComment(expression.value)
           && !needToEscapeCharacterForJSX(expression.raw, JSXExpressionNode) && (
           jsxUtil.isJSX(JSXExpressionNode.parent)
-          || !containsQuoteCharacters(expression.value)
+          || (!containsQuoteCharacters(expression.value) || typeof expression.value === 'string')
         )
       ) {
         reportUnnecessaryCurly(JSXExpressionNode);


Test patch:
diff --git a/tests/lib/rules/jsx-curly-brace-presence.js b/tests/lib/rules/jsx-curly-brace-presence.js
index 4c157deb..259b9538 100755
--- a/tests/lib/rules/jsx-curly-brace-presence.js
+++ b/tests/lib/rules/jsx-curly-brace-presence.js
@@ -934,6 +934,12 @@ ruleTester.run('jsx-curly-brace-presence', rule, {
       errors: [{ messageId: 'unnecessaryCurly' }],
       options: [{ props: 'never', children: 'never', propElementValues: 'never' }],
       features: ['no-ts'],
+    },
+    {
+      code: `<Foo bar={"'"} />`,
+      output: `<Foo bar="'" />`,
+      errors: [{ messageId: 'unnecessaryCurly' }],
+      options: [{ props: 'never', children: 'never', propElementValues: 'never' }],
     }
   )),
 });