Skip to content

Files

Latest commit

 

History

History
19 lines (13 loc) · 479 Bytes

no-useless-promise-resolve-reject.md

File metadata and controls

19 lines (13 loc) · 479 Bytes

Pattern: Redundant Promise.resolve/reject in async context

Issue: -

Description

In async functions or promise callbacks, wrapping return values in Promise.resolve or errors in Promise.reject is unnecessary since these contexts automatically wrap returns in promises and handle thrown errors appropriately.

Examples

Example of incorrect code:

async () => Promise.resolve(bar);

Example of correct code:

async () => bar;