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

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

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


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

export default defineConfig([
  js.configs.recommended,
  {
    rules: {
      'no-delete-var': 'error',
    },
  },
]);
```

## Rule Details

Disallows the use of the `delete` operator on variables.

The purpose of the `delete` operator is to remove a property from an object. Using the `delete` operator on a variable might lead to unexpected behavior.

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

```javascript
var x;
delete x;
```

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

```javascript
var obj = { x: 1 };
delete obj.x;
```

## Original Documentation

- [ESLint: no-delete-var](https://eslint.org/docs/latest/rules/no-delete-var)
- [Source code](https://github.com/eslint/eslint/blob/v10.8.1/lib/rules/no-delete-var.js)
