oxc-project/oxc · error · OxcDiagnostic

Prop "{property}" with value "{property_value}" is forbidden

Error message

Prop "{property}" with value "{property_value}" is forbidden on DOM Nodes

What it means

Raised by react/forbid_dom_props when a forbidden prop is set on a DOM element (lowercase HTML/SVG tag) and the rule config supplies a `allowedFor`/message override or the attribute has a value, producing this message that includes both the property name and its value. At the throw site a host element receives a prop the project has disallowed (often to enforce design-system or a11y policy). run() matches JSX attributes against the configured forbidden list, and the custom message branch takes precedence over the generic variants.

Source

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

use crate::{
    AstNode,
    context::{ContextHost, LintContext},
    rule::{DefaultRuleConfig, Rule},
    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)]

View on GitHub (pinned to e1e7af627c)

Solutions

  1. Change the prop's value to one not forbidden by the configuration.
  2. Remove the prop entirely if it is unnecessary.
  3. Update the forbid entry if this value should be allowed.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/oxc_linter/src/rules/react/forbid_dom_props.rs:30 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/034885a66f4914d8. Report an issue: GitHub.