{"record":{"id":"6157cf0fdf22bf9c","repo":"oxc-project/oxc","slug":"this-component-has-too-many-props-cur-maximum","errorCode":null,"errorMessage":"This component has too many props ({cur}). Maximum allowed is {limit}.","messagePattern":"This component has too many props \\((.+?)\\)\\. Maximum allowed is (.+?)\\.","errorType":"validation","errorClass":"OxcDiagnostic","httpStatus":null,"severity":"warning","filePath":"crates/oxc_linter/src/rules/vue/max_props.rs","lineNumber":28,"sourceCode":"use oxc_macros::declare_oxc_lint;\nuse oxc_span::Span;\nuse oxc_str::CompactStr;\nuse rustc_hash::FxHashSet;\nuse schemars::JsonSchema;\nuse serde::Deserialize;\nuse serde_json::Value;\n\nuse crate::{\n    AstNode,\n    context::LintContext,\n    frameworks::FrameworkOptions,\n    rule::{DefaultRuleConfig, Rule},\n    utils::{find_property, for_each_define_props_type_signature},\n};\n\nfn max_props_diagnostic(span: Span, cur: u32, limit: u32) -> OxcDiagnostic {\n    let msg = format!(\"This component has too many props ({cur}). Maximum allowed is {limit}.\");\n    OxcDiagnostic::warn(msg)\n        .with_help(\n            \"Consider refactoring the component to reduce the number of props that are needed.\",\n        )\n        .with_label(span)\n}\n\n#[derive(Debug, Clone, JsonSchema, Deserialize)]\n#[serde(rename_all = \"camelCase\", default, deny_unknown_fields)]\npub struct MaxProps {\n    /// The maximum number of props allowed in a Vue SFC.\n    max_props: u32,\n}\n\nimpl Default for MaxProps {\n    fn default() -> Self {\n        Self { max_props: 1 }\n    }\n}","sourceCodeStart":10,"sourceCodeEnd":46,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/vue/max_props.rs#L10-L46","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Raise the limit explicitly: \"vue/max-props\": [\"warn\", { \"maxProps\": 5 }]","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","If the component legitimately needs many props (e.g., a wrapper around a DOM element), document why and scope the rule off for it"],"exampleFix":"// before: 3 props with { \"maxProps\": 2 }\n<UserCard name=\"...\" age=\"...\" email=\"...\" />\n// after: group related props\n<UserCard user=\"{user}\" />","handlingStrategy":"validation","validationCode":"// .oxlintrc.json — set an explicit limit; the built-in default is maxProps: 1\n{\n  \"rules\": {\n    \"vue/max-props\": [\"warn\", { \"maxProps\": 5 }]\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always configure maxProps explicitly — the default of 1 flags nearly every real component","Track component prop counts in code review; prefer splitting components over raising the limit"],"tags":["vue","oxlint","lint","component-design","props"],"backgroundTag":"component-too-many-props","analyzedSha":"e1e7af627c8843ab64044ed466b128fcc21a035b","analyzedAt":"2026-08-20T07:01:07.079Z","contentChangedAt":"2026-08-20T07:01:07.079Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}