Is there an existing issue for this?
Description Overview
In some scenarios where {""} is used for whitespace preservation, jsx-curly-brace-presence incorrectly flags the braces as unnecessary, and --fix introduces a visual regression.
export default function App() {
return (
<span>
<span>The braces</span>
{""} matter here.
</span>
);
}
Applying "react/jsx-curly-brace-presence": ["error", { "children": "never" }] to this block causes
5:7 error Curly braces are unnecessary here react/jsx-curly-brace-presence
This is incorrect, since the {""} preserves the whitespace between "braces" and "matter". Additionally, eslint --fix leads to
export default function App() {
return (
<span>
<span>The braces</span>
matter here.
</span>
);
}
which is a visual regression: "The braces matter here." becomes "The bracesmatter here.".
Expected Behavior
jsx-curly-brace-presence should not flag curly braces that are serving a purpose, and eslint --fix should never introduce behavior regressions.
eslint-plugin-react version
v7.37.5
eslint version
v9.39.4
node version
v25.8.0
Is there an existing issue for this?
Description Overview
In some scenarios where
{""}is used for whitespace preservation,jsx-curly-brace-presenceincorrectly flags the braces as unnecessary, and--fixintroduces a visual regression.Applying
"react/jsx-curly-brace-presence": ["error", { "children": "never" }]to this block causesThis is incorrect, since the
{""}preserves the whitespace between "braces" and "matter". Additionally,eslint --fixleads towhich is a visual regression: "The braces matter here." becomes "The bracesmatter here.".
Expected Behavior
jsx-curly-brace-presenceshould not flag curly braces that are serving a purpose, andeslint --fixshould never introduce behavior regressions.eslint-plugin-react version
v7.37.5
eslint version
v9.39.4
node version
v25.8.0