oxc-project/oxc · warning · OxcDiagnostic

This component has too many props ({cur}). Maximum allowed i

Error message

This component has too many props ({cur}). Maximum allowed is {limit}.

What it means

Diagnostic from oxlint's vue/max-props rule (since oxlint 1.19.0). It fires when a Vue SFC component declares more props than the configured limit; the message interpolates the actual count ({cur}) and the limit ({limit}). Note the rule's built-in default is maxProps: 1 (MaxProps::default in max_props.rs), so enabling it without configuration flags almost every component.

Source

Thrown at crates/oxc_linter/src/rules/vue/max_props.rs:28

use oxc_macros::declare_oxc_lint;
use oxc_span::Span;
use oxc_str::CompactStr;
use rustc_hash::FxHashSet;
use schemars::JsonSchema;
use serde::Deserialize;
use serde_json::Value;

use crate::{
    AstNode,
    context::LintContext,
    frameworks::FrameworkOptions,
    rule::{DefaultRuleConfig, Rule},
    utils::{find_property, for_each_define_props_type_signature},
};

fn max_props_diagnostic(span: Span, cur: u32, limit: u32) -> OxcDiagnostic {
    let msg = format!("This component has too many props ({cur}). Maximum allowed is {limit}.");
    OxcDiagnostic::warn(msg)
        .with_help(
            "Consider refactoring the component to reduce the number of props that are needed.",
        )
        .with_label(span)
}

#[derive(Debug, Clone, JsonSchema, Deserialize)]
#[serde(rename_all = "camelCase", default, deny_unknown_fields)]
pub struct MaxProps {
    /// The maximum number of props allowed in a Vue SFC.
    max_props: u32,
}

impl Default for MaxProps {
    fn default() -> Self {
        Self { max_props: 1 }
    }
}

View on GitHub (pinned to e1e7af627c)

Solutions

  1. Raise the limit explicitly: "vue/max-props": ["warn", { "maxProps": 5 }]
  2. Refactor: split the component into smaller ones, group related props into a single object prop, or move shared state to provide/inject or a store
  3. If the component legitimately needs many props (e.g., a wrapper around a DOM element), document why and scope the rule off for it

Example fix

// before: 3 props with { "maxProps": 2 }
<UserCard name="..." age="..." email="..." />
// after: group related props
<UserCard user="{user}" />
Defensive patterns

Strategy: validation

Validate before calling

// .oxlintrc.json — set an explicit limit; the built-in default is maxProps: 1
{
  "rules": {
    "vue/max-props": ["warn", { "maxProps": 5 }]
  }
}

Prevention

When it happens

Trigger: Rule enabled (config struct MaxProps, serde camelCase field `maxProps`, default 1) and a component's props declaration — runtime array/object or type-based signature — contains more entries than the limit. Counting uses for_each_define_props_type_signature and property lookup in the options object.

Common situations: Enabling the rule without setting maxProps and being surprised that any component with 2+ props fails; or gradually growing "god components" crossing a previously safe threshold during feature work.

Related errors


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