> 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.

# avoid-new

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


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

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

Disallow creating `new` promises outside of utility libs (use `util.promisify` instead).

## Rule Details

This rule discourages using the `new Promise` constructor directly. When promisifying callback-based functions, prefer Node's `util.promisify`. When wrapping a plain value or error, prefer `Promise.resolve()` or `Promise.reject()`.

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

```javascript
var x = new Promise(function (resolve, reject) {});
new Promise();
Thing(new Promise(() => {}));
```

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

```javascript
Promise.resolve();
Promise.reject();
Promise.all();
new Horse();
new PromiseLikeThing();
new Promise.resolve();
```

## Original Documentation

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