Skip to content

Commit 374e19e

Browse files
committed
fix(linter): false positive in react/jsx-curly-brace-presence (#10663)
fixes #9123
1 parent 5156822 commit 374e19e

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

crates/oxc_linter/src/rules/react/jsx_curly_brace_presence.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,15 @@ impl JsxCurlyBracePresence {
464464
Expression::TemplateLiteral(template) => {
465465
if allowed.is_never() && template.is_no_substitution_template() {
466466
let string = template.quasi().unwrap();
467-
if is_allowed_string_like(ctx, string.as_str(), container, node.id(), is_prop) {
467+
if contains_quote_characters(string.as_str())
468+
|| is_allowed_string_like(
469+
ctx,
470+
string.as_str(),
471+
container,
472+
node.id(),
473+
is_prop,
474+
)
475+
{
468476
return;
469477
}
470478
report_unnecessary_curly(ctx, container, template.span);
@@ -822,6 +830,7 @@ fn test() {
822830
),
823831
("<App label={`${label}`} />", Some(json!(["never"]))),
824832
("<App>{`${label}`}</App>", Some(json!(["never"]))),
833+
(r#"<div>{`Nobody's "here"`}</div>"#, None),
825834
];
826835

827836
let fail = vec![

0 commit comments

Comments
 (0)