oxc-project/oxc · error · OxcDiagnostic

Curly braces are required here.

Error message

Curly braces are required here.

What it means

Emitted by the missing-curly reporters of the react jsx-curly-brace-presence rule when a JSX expression or attribute requires braces under the configured style but has none — e.g. a string prop containing quotes or special characters that must be escaped, or an expression child written as bare text.

Source

Thrown at crates/oxc_linter/src/rules/react/jsx_curly_brace_presence.rs:28

    AstKind,
    ast::{
        Expression, JSXAttributeItem, JSXAttributeValue, JSXChild, JSXElementName, JSXExpression,
        JSXExpressionContainer,
    },
};
use oxc_codegen::CodegenOptions;
use oxc_diagnostics::{LabeledSpan, OxcDiagnostic};
use oxc_macros::declare_oxc_lint;
use oxc_semantic::NodeId;
use oxc_span::{GetSpan as _, Span};
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};

fn jsx_curly_brace_presence_unnecessary_diagnostic(span: Span) -> OxcDiagnostic {
    OxcDiagnostic::warn("Curly braces are unnecessary here.").with_label(span)
}
fn jsx_curly_brace_presence_necessary_diagnostic(span: Span) -> OxcDiagnostic {
    OxcDiagnostic::warn("Curly braces are required here.")
        .with_help("Wrap this value in curly braces")
        .with_labels([LabeledSpan::new_primary_with_span(
            Some("Wrap this value in curly braces".into()),
            span,
        )])
}

#[derive(Debug, Default, Clone, Copy, JsonSchema, Deserialize, Serialize)]
#[serde(rename_all = "kebab-case")]
enum JsxCurlyBracePresenceMode {
    Always,
    Never,
    #[default]
    Ignore,
}

impl JsxCurlyBracePresenceMode {
    pub fn is_never(self) -> bool {

View on GitHub (pinned to 36ec0ef2ba)

Solutions

  1. Wrap the value in curly braces, e.g. prop={"'quoted'"} for strings containing quote characters
  2. Adjust the rule's propValue/elem/attr options if the brace requirement is unwanted
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/oxc_linter/src/rules/react/jsx_curly_brace_presence.rs:28 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of oxc-project/oxc@36ec0ef2ba (2026-08-20). Data as JSON: /api/errors/01a17614613d9311. Report an issue: GitHub.