]> git.proxmox.com Git - pve-eslint.git/blame - eslint/docs/src/rules/no-delete-var.md
import 8.41.0 source
[pve-eslint.git] / eslint / docs / src / rules / no-delete-var.md
CommitLineData
8f9d1d4d
DC
1---
2title: no-delete-var
8f9d1d4d
DC
3rule_type: suggestion
4---
5
6
eb39fafa
DC
7
8The 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.
9
10## Rule Details
11
12This rule disallows the use of the `delete` operator on variables.
13
14If ESLint parses code in strict mode, the parser (instead of this rule) reports the error.
15
16Examples of **incorrect** code for this rule:
17
8f9d1d4d
DC
18::: incorrect
19
eb39fafa
DC
20```js
21/*eslint no-delete-var: "error"*/
22
23var x;
24delete x;
25```
8f9d1d4d
DC
26
27:::