> 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-array-delete

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

| Preset                              | Configured Value |
| ----------------------------------- | ---------------- |
| ✅ ts.configs.recommendedTypeChecked | `"error"`        |
| ✅ ts.configs.strictTypeChecked      | `"error"`        |


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

export default defineConfig([
  ts.configs.recommended,
  {
    rules: {
      '@typescript-eslint/no-array-delete': 'error',
    },
  },
]);
```

## Rule Details

Disallow using the `delete` operator on array values. Using `delete` on an array element sets it to `undefined` and leaves a hole in the array without changing its length. This is almost always a mistake -- `Array.prototype.splice()` should be used instead to remove elements.

The rule uses type information to detect when the `delete` target is an array or tuple type.

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

```typescript
const arr = [1, 2, 3];
delete arr[1]; // arr is now [1, undefined, 3]

const tuple: [string, number] = ['a', 1];
delete tuple[0];
```

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

```typescript
const arr = [1, 2, 3];
arr.splice(1, 1); // arr is now [1, 3]

const obj: Record<string, number> = { a: 1 };
delete obj['a']; // objects are fine
```

## Original Documentation

- [typescript-eslint: no-array-delete](https://typescript-eslint.io/rules/no-array-delete)
- [Source code](https://github.com/typescript-eslint/typescript-eslint/blob/v8.67.0/packages/eslint-plugin/src/rules/no-array-delete.ts)
