oxc-project/oxc · error · OxcDiagnostic

{message}

Error message

{message}

What it means

Custom-message variant of react/forbid-component-props: the diagnostic message comes entirely from the user-configured message for a forbidden prop. It fires when a React component uses a prop listed in the rule's forbid configuration.

Source

Thrown at crates/oxc_linter/src/rules/react/forbid_component_props.rs:24

use oxc_span::{GetSpan, Span};
use oxc_str::CompactStr;
use schemars::JsonSchema;
use serde::Deserialize;

use crate::utils::{get_jsx_element_name, is_react_component_name};
use crate::{
    AstNode,
    context::{ContextHost, LintContext},
    rule::{DefaultRuleConfig, Rule},
};

fn forbid_component_props_diagnostic(
    span: Span,
    prop: &str,
    message: Option<&str>,
) -> OxcDiagnostic {
    if let Some(message) = message {
        return OxcDiagnostic::warn(message.to_string()).with_label(span);
    }
    OxcDiagnostic::warn(format!("Prop \"{prop}\" is forbidden on Components")).with_label(span)
}

#[derive(Debug, Default, Clone)]
struct ForbidOption {
    /// Whether this entry was defined via `propNamePattern` (glob) instead of `propName`.
    is_pattern: bool,
    allowed_for: Vec<CompactStr>,
    allowed_for_patterns: Vec<CompactStr>,
    disallowed_for: Vec<CompactStr>,
    disallowed_for_patterns: Vec<CompactStr>,
    message: Option<String>,
}

impl ForbidOption {
    fn is_forbidden(&self, tag_name: Option<&str>) -> bool {
        let Some(tag) = tag_name else {

View on GitHub (pinned to e1e7af627c)

Solutions

  1. Remove the forbidden prop from the component usage.
  2. Replace it with an allowed alternative named in the rule configuration.
  3. Update or remove the rule configuration if the prop should be permitted.
Defensive patterns

Strategy: validation

When it happens

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

Common situations: See trigger scenarios.


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