promise/no-return-in-finally
Configuration
rslint.config.ts
Disallow return statements inside a callback passed to .finally(), since nothing would consume what's returned.
Rule Details
Examples of incorrect code for this rule:
Examples of correct code for this rule:
Original Documentation
ESLint Parity and Compatibility
To align with the behavior of eslint-plugin-promise's no-return-in-finally rule, the following behaviors are intentionally preserved:
- Nested Return Statements: ESLint's rule only checks top-level statements directly inside the finally callback's block body. It ignores nested return statements (e.g., inside an
ifstatement block, atry/catchblock, or any nested block). rslint mirrors this behavior and only flags top-level returns directly under the main function body block. - Implicit Arrow Returns: ESLint does not flag implicit returns in arrow functions without a block body (e.g.,
promise.finally(() => 2)). rslint also does not flag these implicit returns.