Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/jsx-curly-brace-presence.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 6 additions & 0 deletions tests/lib/rules/jsx-curly-brace-presence.js
Original file line number Diff line number Diff line change
Expand Up @@ -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' }],
}
)),
});