> For AI agents: the complete documentation index is available at https://rslint.rs/llms.txt, the full documentation bundle is available at https://rslint.rs/llms-full.txt.

# no-return-wrap

[Added in v0.6.0](https://github.com/web-infra-dev/rslint/releases/tag/v0.6.0)
## Configuration

| Preset                              | Configured Value |
| ----------------------------------- | ---------------- |
| ✅ promisePlugin.configs.recommended | `"error"`        |


```ts title=rslint.config.ts
import { defineConfig, promisePlugin } from '@rslint/core';

export default defineConfig([
  promisePlugin.configs.recommended,
  {
    rules: {
      'promise/no-return-wrap': 'error',
    },
  },
]);
```

Disallow wrapping values in `Promise.resolve` or `Promise.reject` when not needed.

## Rule Details

Inside a `.then()`, `.catch()`, or `.finally()` callback, returning a raw value
already resolves the promise chain with that value, and throwing already rejects
it. This rule reports callbacks that return `Promise.resolve(...)` or
`Promise.reject(...)` instead of using the direct value or `throw`.

Examples of **incorrect** code for this rule:

```javascript
promise.then(function (value) {
  return Promise.resolve(value * 2)
})

promise.catch(function (error) {
  return Promise.reject(error)
})

promise.then(() => Promise.resolve(42))
```

Examples of **correct** code for this rule:

```javascript
promise.then(function (value) {
  return value * 2
})

promise.catch(function (error) {
  throw error
})

promise.then(() => 42)
```

## Options

### `allowReject`

Pass `{ "allowReject": true }` to allow returning `Promise.reject(...)` from a
promise callback. `Promise.resolve(...)` remains disallowed.

```json
{ "promise/no-return-wrap": ["error", { "allowReject": true }] }
```

```javascript
promise.catch(function (error) {
  return Promise.reject(error)
})
```

## Differences from ESLint

None known.

## Original Documentation

- [eslint-plugin-promise: no-return-wrap](https://github.com/eslint-community/eslint-plugin-promise/blob/v7.3.0/docs/rules/no-return-wrap.md)
- [Source code](https://github.com/eslint-community/eslint-plugin-promise/blob/v7.3.0/rules/no-return-wrap.js)
