oxc-project/oxc · error · OxcDiagnostic

Invalid property found

Error message

Invalid property found

What it means

Raised by react/no-unknown-property when a JSX attribute is valid HTML/React but is only allowed on specific tags and appears on another tag (e.g. alt on a non-media element). The help text lists the allowed tags.

Source

Thrown at crates/oxc_linter/src/rules/react/no_unknown_property.rs:26

};
use oxc_diagnostics::OxcDiagnostic;
use oxc_macros::declare_oxc_lint;
use oxc_span::{GetSpan, Span};
use phf::{Map, Set, phf_map, phf_set};
use rustc_hash::{FxHashMap, FxHashSet};
use schemars::JsonSchema;
use serde::Deserialize;

use crate::{
    AstNode,
    context::{ContextHost, LintContext},
    globals::is_valid_aria_property,
    rule::{DefaultRuleConfig, Rule},
    utils::get_jsx_attribute_name,
};

fn invalid_prop_on_tag(span: Span, prop: &str, tag: &str) -> OxcDiagnostic {
    OxcDiagnostic::warn("Invalid property found")
        .with_help(format!("Property '{prop}' is only allowed on: {tag}"))
        .with_label(span)
}

fn data_lowercase_required(span: Span, suggested_prop: &str) -> OxcDiagnostic {
    OxcDiagnostic::warn(
        "React does not recognize data-* props with uppercase characters on a DOM element",
    )
    .with_help(format!("Use '{suggested_prop}' instead"))
    .with_label(span)
}

fn unknown_prop_with_standard_name(span: Span, x1: &str) -> OxcDiagnostic {
    OxcDiagnostic::warn("Unknown property found")
        .with_help(format!("Use '{x1}' instead"))
        .with_label(span)
}

View on GitHub (pinned to e1e7af627c)

Solutions

  1. Move the property to one of the allowed tags listed in the help text.
  2. Remove the property if it has no effect on the current element.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/oxc_linter/src/rules/react/no_unknown_property.rs:26 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/9d55a3af36be770d. Report an issue: GitHub.