]> git.proxmox.com Git - pve-eslint.git/blob - eslint/docs/rules/no-delete-var.md
ab90d11395d84351c95ab4979370badc1dc49ee7
[pve-eslint.git] / eslint / docs / rules / no-delete-var.md
1 # disallow deleting variables (no-delete-var)
2
3 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.
4
5 ## Rule Details
6
7 This rule disallows the use of the `delete` operator on variables.
8
9 If ESLint parses code in strict mode, the parser (instead of this rule) reports the error.
10
11 Examples of **incorrect** code for this rule:
12
13 ```js
14 /*eslint no-delete-var: "error"*/
15
16 var x;
17 delete x;
18 ```