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

# new-for-builtins

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

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


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

export default defineConfig([
  unicornPlugin.configs.recommended,
  {
    rules: {
      'unicorn/new-for-builtins': 'error',
    },
  },
]);
```

## Rule Details

Many builtin constructors can be called with or without `new`, but constructor
calls are clearer and more consistent when they use `new`. This rule also
reports selected builtin namespace objects that are neither callable nor
constructible.

Optional calls that would need to become optional constructors are ignored,
because `new` cannot be optional.

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

```javascript
const list = Array(10);
const map = Map([["foo", "bar"]]);
const now = Date();
const tag = WebAssembly.JSTag();
const text = new String("value");
```

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

```javascript
const list = new Array(10);
const map = new Map([["foo", "bar"]]);
const now = String(new Date());
const text = String("value");
```

## Original Documentation

- [eslint-plugin-unicorn: new-for-builtins](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v70.0.0/docs/rules/new-for-builtins.md)
- [Source code](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v70.0.0/rules/new-for-builtins.js)
