{"record":{"id":"0a928485621e21a0","repo":"oxc-project/oxc","slug":"unexpected-spread-argument","errorCode":null,"errorMessage":"Unexpected spread argument.","messagePattern":"Unexpected spread argument\\.","errorType":"validation","errorClass":"OxcDiagnostic","httpStatus":null,"severity":"warning","filePath":"crates/oxc_linter/src/rules/vue/no_multiple_slot_args.rs","lineNumber":24,"sourceCode":"    },\n};\nuse oxc_diagnostics::OxcDiagnostic;\nuse oxc_macros::declare_oxc_lint;\nuse oxc_span::{GetSpan, Span};\n\nuse crate::{\n    AstNode, ast_util::variable_declaration_kind, context::LintContext,\n    frameworks::FrameworkOptions, rule::Rule,\n};\n\nfn multiple_arguments_diagnostic(span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\"Unexpected multiple arguments.\")\n        .with_help(\"Pass only one argument to the slot function.\")\n        .with_label(span)\n}\n\nfn spread_argument_diagnostic(span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\"Unexpected spread argument.\")\n        .with_help(\"Do not use spread arguments when calling slot functions.\")\n        .with_label(span)\n}\n\n#[derive(Debug, Default, Clone)]\npub struct NoMultipleSlotArgs;\n\ndeclare_oxc_lint!(\n    /// ### What it does\n    ///\n    /// Disallow passing multiple arguments to scoped slots.\n    ///\n    /// ### Why is this bad?\n    ///\n    /// Users have to use the arguments in fixed order and cannot omit the ones they don't need.\n    /// e.g. if you have a slot that passes in 5 arguments but the user actually only need the last 2 of them,\n    /// they will have to declare all 5 just to use the last 2.\n    ///","sourceCodeStart":6,"sourceCodeEnd":42,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/vue/no_multiple_slot_args.rs#L6-L42","documentation":"The companion diagnostic of vue/no-multiple-slot-args: 'Unexpected spread argument.' — spreading arguments into a scoped-slot call, e.g. `this.$slots.default(...args)`. Slot functions take a single props object, so a spread either forwards multiple positional arguments (ignored by Vue) or hides what is actually being passed, and the rule flags it with the help text 'Do not use spread arguments when calling slot functions.'","triggerScenarios":"Calling a slot function with a spread element in the argument list: `slots.default(...props)`, `this.$scopedSlots.default(...args)` — any SpreadElement at the call site of a scoped slot.","commonSituations":"Generic slot-forwarding wrappers that collect args and spread them; refactoring from rest parameters; TSX wrappers around arbitrary children slots.","solutions":["Replace the spread with an explicit single object: `this.$slots.default({ ...props })` — note the braces make it one object argument.","Name the fields you forward so the slot contract is visible at the call site.","If the wrapper truly receives a props object, pass it directly: `slots.default(props)`.","Re-run oxlint to confirm no spread remains at slot call sites."],"exampleFix":"// before\nrender() {\n  return this.$slots.default(...this.item, this.index);\n}\n\n// after\nrender() {\n  return this.$slots.default({ item: this.item, index: this.index });\n}","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never spread into a slot function call; build an explicit props object.","Name every forwarded field at the call site so the slot contract stays visible.","Lint render-heavy wrapper components regularly with the Vue plugin."],"tags":["vue","slots","lint","spread","render-function"],"backgroundTag":"wrong-argument-count","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"}