{"record":{"id":"485919ecb5b892c6","repo":"oxc-project/oxc","slug":"expected-to-return-a-value-in-computed-property","errorCode":null,"errorMessage":"Expected to return a value in computed property.","messagePattern":"Expected to return a value in computed property\\.","errorType":"validation","errorClass":"OxcDiagnostic","httpStatus":null,"severity":"error","filePath":"crates/oxc_linter/src/rules/vue/return_in_computed_property.rs","lineNumber":16,"sourceCode":"use oxc_ast::AstKind;\nuse oxc_diagnostics::OxcDiagnostic;\nuse oxc_macros::declare_oxc_lint;\nuse oxc_span::Span;\nuse schemars::JsonSchema;\nuse serde::{Deserialize, Serialize};\n\nuse crate::{\n    AstNode,\n    context::{ContextHost, LintContext},\n    rule::{DefaultRuleConfig, Rule},\n    utils::{definitely_returns_in_all_codepaths, get_computed_getter_context},\n};\n\nfn return_in_computed_property_diagnostic(span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\"Expected to return a value in computed property.\")\n        .with_help(\"All code paths inside a computed getter must return a value.\")\n        .with_label(span)\n}\n\n#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]\n#[serde(rename_all = \"camelCase\", default, deny_unknown_fields)]\nstruct ReturnInComputedPropertyConfig {\n    /// When `true` (default), `return;` (without a value) is treated as a missing return.\n    /// Set to `false` to allow bare `return;` as if it returned a value.\n    treat_undefined_as_unspecified: bool,\n}\n\nimpl Default for ReturnInComputedPropertyConfig {\n    fn default() -> Self {\n        Self { treat_undefined_as_unspecified: true }\n    }\n}\n","sourceCodeStart":1,"sourceCodeEnd":34,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/vue/return_in_computed_property.rs#L1-L34","documentation":"Emitted by run of the vue return-in-computed-property rule when a computed getter has a code path that returns no value (checked via definitely_returns_in_all_code_paths_paths helper over the getter context). It is a control-flow guard: a computed that returns undefined on some path produces inconsistent state.","triggerScenarios":"Thrown at crates/oxc_linter/src/rules/vue/return_in_computed_property.rs:16 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure every branch of the computed getter returns a value","Add a default/fallback return at the end of the getter"],"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-14T05:17:10.506Z"}