{"record":{"id":"84e19800363408ab","repo":"oxc-project/oxc","slug":"property-in-slots-should-be-used-as-function","errorCode":null,"errorMessage":"Property in `$slots` should be used as function.","messagePattern":"Property in `\\$slots` should be used as function\\.","errorType":"validation","errorClass":"OxcDiagnostic","httpStatus":null,"severity":"error","filePath":"crates/oxc_linter/src/rules/vue/require_slots_as_functions.rs","lineNumber":18,"sourceCode":"use oxc_ast::{\n    AstKind,\n    ast::{AssignmentTarget, ChainElement, Expression, StaticMemberExpression},\n};\nuse oxc_diagnostics::OxcDiagnostic;\nuse oxc_macros::declare_oxc_lint;\nuse oxc_semantic::SymbolId;\nuse oxc_span::{GetSpan, Span};\n\nuse crate::{\n    AstNode,\n    context::LintContext,\n    rule::Rule,\n    utils::{is_this_object, is_vue_component_options_object},\n};\n\nfn require_slots_as_functions_diagnostic(span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\"Property in `$slots` should be used as function.\").with_label(span)\n}\n\n#[derive(Debug, Default, Clone)]\npub struct RequireSlotsAsFunctions;\n\ndeclare_oxc_lint!(\n    /// ### What it does\n    ///\n    /// Enforce properties of `$slots` to be used as functions.\n    ///\n    /// ### Why is this bad?\n    ///\n    /// In Vue.js 3, `this.$slots.<name>` is a function (slot render function),\n    /// not an array of vnodes like in Vue.js 2. Treating slot properties as\n    /// values (e.g. `this.$slots.default.filter(...)`) breaks at runtime.\n    ///\n    /// ### Examples\n    ///","sourceCodeStart":1,"sourceCodeEnd":36,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/vue/require_slots_as_functions.rs#L1-L36","documentation":"Emitted by verify in the vue require-slots-as-functions rule when a property of the $slots object is accessed as a plain value (e.g. this.$slots.default) rather than called as a function. In Vue 3 slots are functions returning VNodes, so non-call usage reads stale or incorrect content.","triggerScenarios":"Thrown at crates/oxc_linter/src/rules/vue/require_slots_as_functions.rs:18 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Call the slot, e.g. this.$slots.default?.() or renderSlots helper","Pass slot functions to h() as children rather than reading them as values"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e1e7af627c8843ab64044ed466b128fcc21a035b","analyzedAt":"2026-08-20T07:01:07.079Z","contentChangedAt":"2026-08-20T07:01:07.079Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}