This rule raises an issue when Promise.resolve() or Promise.reject() are returned or yielded in async functions, async generators, or promise callback methods (then/catch/finally).

Why is this an issue?

In JavaScript, async functions and promise callback methods automatically wrap return values in promises. Using Promise.resolve() or Promise.reject() in these contexts creates unnecessary complexity and redundancy.

When you return a value from an async function, it’s automatically wrapped in a resolved promise. Similarly, when you return from a .then(), .catch(), or .finally() callback, the value is automatically wrapped in a promise.

For error handling, throwing an error is more idiomatic and clearer than returning Promise.reject(). The throw statement clearly indicates that an error condition has occurred, while return Promise.reject() obscures this intent.

This redundancy makes code harder to read and understand, especially for developers learning async programming patterns. It also suggests a misunderstanding of how promises and async functions work.

What is the potential impact?

This issue primarily affects code maintainability and readability. While it doesn’t cause runtime errors, it:

How to fix?

Remove the unnecessary Promise.resolve() wrapper and return the value directly in async functions.

Non-compliant code example

const fetchData = async () => {
  const result = await getData();
  return Promise.resolve(result); // Noncompliant
};

Compliant code example

const fetchData = async () => {
  const result = await getData();
  return result;
};

Documentation