{"record":{"id":"f1669e6c14658c82","repo":"oxc-project/oxc","slug":"expected-to-return-a-value-in-render-function","errorCode":null,"errorMessage":"Expected to return a value in render function.","messagePattern":"Expected to return a value in render function\\.","errorType":"validation","errorClass":"OxcDiagnostic","httpStatus":null,"severity":"error","filePath":"crates/oxc_linter/src/rules/vue/require_render_return.rs","lineNumber":14,"sourceCode":"use oxc_ast::AstKind;\nuse oxc_diagnostics::OxcDiagnostic;\nuse oxc_macros::declare_oxc_lint;\nuse oxc_span::{GetSpan, Span};\n\nuse crate::{\n    AstNode,\n    context::LintContext,\n    rule::Rule,\n    utils::{definitely_returns_in_all_codepaths, is_vue_component_options_object},\n};\n\nfn require_render_return_diagnostic(span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\"Expected to return a value in render function.\")\n        .with_help(\"All code paths inside a render function must return a value.\")\n        .with_label(span)\n}\n\n#[derive(Debug, Default, Clone)]\npub struct RequireRenderReturn;\n\ndeclare_oxc_lint!(\n    /// ### What it does\n    ///\n    /// Enforce that a `render` function always returns a value.\n    ///\n    /// ### Why is this bad?\n    ///\n    /// A Vue component's `render` function must produce a VNode tree. If a\n    /// code path falls through without returning, Vue receives `undefined`\n    /// and silently renders nothing.\n    ///","sourceCodeStart":1,"sourceCodeEnd":32,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/vue/require_render_return.rs#L1-L32","documentation":"Emitted by run of the vue require-render-return rule when a component's render function has at least one code path that does not return a value (checked via definitely_returns_in_all_codepaths). It is a control-flow guard: render must always return a VNode or rendering silently fails.","triggerScenarios":"Thrown at crates/oxc_linter/src/rules/vue/require_render_return.rs:14 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure every branch of the render function returns a VNode, including else branches and early returns","Add a final fallback return statement, e.g. return h('div')"],"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"}