{"record":{"id":"4beeaa360a0f1488","repo":"oxc-project/oxc","slug":"invalid-fix-capabilities-did-you-mean-fix","errorCode":null,"errorMessage":"Invalid fix capabilities. Did you mean 'fix'?","messagePattern":"Invalid fix capabilities\\. Did you mean 'fix'\\?","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"crates/oxc_macros/src/declare_oxc_lint.rs","lineNumber":424,"sourceCode":"\nfn parse_fix(s: &str) -> proc_macro2::TokenStream {\n    const SEP: char = '_';\n\n    match s {\n        \"none\" => {\n            return quote! { RuleFixMeta::None };\n        }\n        \"pending\" => {\n            return quote! { RuleFixMeta::FixPending };\n        }\n        \"fix\" => return quote! { RuleFixMeta::Fixable(FixKind::SafeFix) },\n        \"suggestion\" => return quote! { RuleFixMeta::Fixable(FixKind::Suggestion) },\n        \"conditional\" => {\n            panic!(\"Invalid fix capabilities: missing a fix kind. Did you mean 'fix-conditional'?\")\n        }\n        \"None\" => panic!(\"Invalid fix capabilities. Did you mean 'none'?\"),\n        \"Pending\" => panic!(\"Invalid fix capabilities. Did you mean 'pending'?\"),\n        \"Fix\" => panic!(\"Invalid fix capabilities. Did you mean 'fix'?\"),\n        \"Suggestion\" => panic!(\"Invalid fix capabilities. Did you mean 'suggestion'?\"),\n        invalid if !invalid.contains(SEP) => panic!(\n            \"invalid fix capabilities: {invalid}. Valid capabilities are none, pending, fix, suggestion, or [fix|suggestion]_[conditional?]_[dangerous?].\"\n        ),\n        _ => {}\n    }\n\n    assert!(s.contains(SEP));\n\n    let mut is_conditional = false;\n    let fix_kinds = s\n        .split(SEP)\n        .filter(|seg| match *seg {\n            \"conditional\" => {\n                is_conditional = true;\n                false\n            }\n            // e.g. \"safe_fix\". safe is implied","sourceCodeStart":406,"sourceCodeEnd":442,"githubUrl":"https://github.com/oxc-project/oxc/blob/a3d33dda7cb69da23db4fcaa2c0c05de61e760a1/crates/oxc_macros/src/declare_oxc_lint.rs#L406-L442","documentation":"Diagnostic from oxlint's vue/return-in-computed-property rule (crates/oxc_linter/src/rules/vue/return_in_computed_property.rs). Every computed getter must return a value on all code paths — a falling-through path yields `undefined`, which then flows silently into templates and other computeds. The rule analyzes the getter body (definitely_returns_in_all_codepaths over the computed getter context) and, by default (`treatUndefinedAsUnspecified: true`), treats a bare `return;` as a missing return.","triggerScenarios":"`computed: { total() { if (this.items) return this.items.length; } }` — the else path returns undefined. Also getters whose only returns sit inside callbacks (which don't count as returns of the getter), and bare `return;` statements under the default option.","commonSituations":"Guard clauses added to computeds; refactoring computed logic into forEach callbacks where returns no longer propagate; migrating Vue 2 components with loose getter styles.","solutions":["Add a final fallback return: `return 0;`.","Restructure to a single return: `return this.items ? this.items.length : 0;`.","If bare `return;` is accepted team style, set the rule option treatUndefinedAsUnspecified: false."],"exampleFix":"// before\ncomputed: {\n  total() { if (this.items) return this.items.length; }\n}\n\n// after\ncomputed: {\n  total() { return this.items ? this.items.length : 0; }\n}","handlingStrategy":"validation","validationCode":"// a computed getter must contain a value-returning statement\nfunction getterReturns(getterSrc) {\n  const body = getterSrc.slice(getterSrc.indexOf('{') + 1, getterSrc.lastIndexOf('}'));\n  return /\\breturn\\s+[^;\\s]/.test(body);\n}\nif (!getterReturns(getterSource)) {\n  throw new Error('computed getter must return a value on every path');\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["End every computed getter with an unconditional return.","Prefer single-expression getters over guard-clause chains.","Unit-test computeds against edge inputs, asserting a non-undefined result."],"tags":["vue","oxlint","lint","computed","control-flow","options-api"],"backgroundTag":"computed-property-missing-return","analyzedSha":"a3d33dda7cb69da23db4fcaa2c0c05de61e760a1","analyzedAt":"2026-08-20T07:01:07.079Z","contentChangedAt":"2026-08-20T07:01:07.079Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}