{"record":{"id":"2e7297e7f69cfea1","repo":"oxc-project/oxc","slug":"unexpected-return-value-in-callback-for-method-na","errorCode":null,"errorMessage":"Unexpected return value in callback for {method_name:?}","messagePattern":"Unexpected return value in callback for (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/oxc_linter/src/rules/eslint/array_callback_return/mod.rs","lineNumber":115,"sourceCode":"            ),\n        ),\n    };\n\n    let mut diagnostic = OxcDiagnostic::warn(message).with_help(help).with_label(diagnostic_span);\n    if allow_implicit {\n        diagnostic = diagnostic.with_note(\"With `allowImplicit`, callbacks that don't explicitly return a value are considered to return `undefined`.\");\n    }\n    if let Some((hint_span, _)) = hint {\n        diagnostic = diagnostic\n            .and_label(hint_span.label(\"This path may reach the end of the callback.\"))\n            .and_label(array_method_span.label(format!(\"{method_name:?} is called here.\")));\n    }\n\n    diagnostic\n}\n\nfn expect_no_return(method_name: &str, call_span: Span, return_span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(format!(\"Unexpected return value in callback for {method_name:?}\"))\n        .with_help(format!(\n            \"{method_name:?} ignores the callback's return value. Remove the returned value (use `return;` or no `return`), or use `map`/`flatMap` if you meant to produce a new array.\"\n        ))\n        .with_labels([\n            call_span.label(format!(\"{method_name:?} is called here.\")),\n            return_span.label(\"This returned value is ignored.\"),\n        ])\n}\n\nfn expect_void_return(method_name: &str, call_span: Span, return_span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(format!(\"Unexpected return value in callback for {method_name:?}\"))\n        .with_help(\"Expected the return expression to be started with `void`\")\n        .with_labels([\n            call_span.label(format!(\"{method_name:?} is called here.\")),\n            return_span.label(\"Prepend `void` to the expression.\"),\n        ])\n}\n","sourceCodeStart":97,"sourceCodeEnd":133,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/eslint/array_callback_return/mod.rs#L97-L133","documentation":"Lint diagnostic from eslint/array-callback-return (expect_no_return): a callback passed to an array method whose return value is ignored (e.g. forEach, every's opposite set) explicitly returns a value. The returned value goes nowhere, so the return suggests the wrong method is being used.","triggerScenarios":"Thrown at crates/oxc_linter/src/rules/eslint/array_callback_return/mod.rs:115 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Remove the return statement if the side effect is intended","Switch to the appropriate method such as map, filter, or some when the return value matters"],"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"}