oxc-project/oxc · error · OxcDiagnostic

Prop "{property}" is forbidden on DOM Nodes

Error message

Prop "{property}" is forbidden on DOM Nodes

What it means

Raised by react/forbid_dom_props when a configured-forbidden prop appears on a DOM element and no value is present (boolean-style attribute) and no custom message is configured. At the throw site a host element like `<div propName />` carries a prop the project forbids on DOM nodes. forbid_dom_props_diagnostic falls through to this generic message after the custom-message and value-bearing branches are exhausted.

Source

Thrown at crates/oxc_linter/src/rules/react/forbid_dom_props.rs:35

    utils::is_react_component_name,
};

fn forbid_dom_props_diagnostic(
    span: Span,
    property: &str,
    property_value: Option<&str>,
    message: Option<&String>,
) -> OxcDiagnostic {
    if let Some(message) = message {
        return OxcDiagnostic::warn(message.clone()).with_label(span);
    }
    if let Some(property_value) = property_value {
        return OxcDiagnostic::warn(format!(
            r#"Prop "{property}" with value "{property_value}" is forbidden on DOM Nodes"#
        ))
        .with_label(span);
    }
    OxcDiagnostic::warn(format!(r#"Prop "{property}" is forbidden on DOM Nodes"#)).with_label(span)
}

#[derive(Debug, Default, Clone)]
struct ForbidPropOptions {
    disallowed_for: FxHashSet<CompactStr>,
    disallowed_values: Option<FxHashSet<CompactStr>>,
    message: Option<String>,
}

#[derive(Debug, Default, Clone, Deserialize, JsonSchema)]
#[serde(from = "ForbidDomPropsConfig")]
pub struct ForbidDomProps {
    #[serde(skip)]
    forbid: Box<FxHashMap<CompactStr, ForbidPropOptions>>,
}

impl From<ForbidDomPropsConfig> for ForbidDomProps {
    fn from(config: ForbidDomPropsConfig) -> Self {

View on GitHub (pinned to e1e7af627c)

Solutions

  1. Remove the forbidden prop from the DOM element.
  2. Substitute the standard/allowed attribute for the forbidden one.
Defensive patterns

Strategy: validation

When it happens

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

Common situations: See trigger scenarios.

Understand the failure class


AI-assisted analysis of oxc-project/oxc@e1e7af627c (2026-08-20). Data as JSON: /api/errors/4b60a864d8f86788. Report an issue: GitHub.