{"record":{"id":"4babce4c042e0162","repo":"oxc-project/oxc","slug":"return-statement-should-not-be-used-in-promise-exe","errorCode":null,"errorMessage":"Return statement should not be used in Promise executor.","messagePattern":"Return statement should not be used in Promise executor\\.","errorType":"validation","errorClass":"OxcDiagnostic","httpStatus":null,"severity":"error","filePath":"crates/oxc_linter/src/rules/eslint/no_promise_executor_return.rs","lineNumber":19,"sourceCode":"use oxc_ast::{\n    AstKind,\n    ast::{Argument, Expression, FunctionBody},\n};\nuse oxc_ast_visit::VisitJs;\nuse oxc_diagnostics::OxcDiagnostic;\nuse oxc_macros::declare_oxc_lint;\nuse oxc_span::{GetSpan, Span};\nuse schemars::JsonSchema;\nuse serde::Deserialize;\n\nuse crate::{\n    AstNode,\n    context::LintContext,\n    rule::{DefaultRuleConfig, Rule},\n};\n\nfn no_promise_executor_return_diagnostic(span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\"Return statement should not be used in Promise executor.\")\n        .with_help(\"Use `resolve()` or `reject()` instead of returning a value.\")\n        .with_label(span)\n}\n\n#[derive(Debug, Default, Clone, Deserialize)]\npub struct NoPromiseExecutorReturn(Box<NoPromiseExecutorReturnConfig>);\n\n#[derive(Debug, Default, Clone, JsonSchema, Deserialize)]\n#[serde(rename_all = \"camelCase\", default, deny_unknown_fields)]\npub struct NoPromiseExecutorReturnConfig {\n    /// If `true`, allows returning `void` expressions (e.g., `return void resolve()`).\n    allow_void: bool,\n}\n\nimpl std::ops::Deref for NoPromiseExecutorReturn {\n    type Target = NoPromiseExecutorReturnConfig;\n\n    fn deref(&self) -> &Self::Target {","sourceCodeStart":1,"sourceCodeEnd":37,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/eslint/no_promise_executor_return.rs#L1-L37","documentation":"Lint diagnostic from eslint/no-promise-executor-return: a return statement with a value appears inside a Promise executor function. The return value is silently ignored, so it reads as if it resolved/rejected the promise when it did nothing; only resolve/reject control the outcome.","triggerScenarios":"Thrown at crates/oxc_linter/src/rules/eslint/no_promise_executor_return.rs:19 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Call resolve(value) or reject(error) instead of returning","Await an inner async IIFE if truly needed (allowIIFE option) rather than returning from the executor"],"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"}