return-await
Configuration
rslint.config.ts
Rule Details
Enforce consistent returning of awaited values. This rule controls whether return await should be used in async functions. Depending on the configuration, it enforces one of several strategies:
in-try-catch(default): Requiresawaitin try/catch/finally blocks (for proper error handling) and disallows it elsewhere (for performance).always: Always requiresreturn await.never: Always disallowsreturn await.error-handling-correctness-only: Only requiresawaitwhere it affects error handling correctness, with no preference otherwise.
Using return await inside try/catch ensures the promise rejection is caught in the local catch block. Outside try/catch, the await adds unnecessary overhead.
Examples of incorrect code for this rule (with default in-try-catch):
Examples of correct code for this rule (with default in-try-catch):