]> git.proxmox.com Git - pve-eslint.git/blob - eslint/docs/rules/no-empty-label.md
first commit
[pve-eslint.git] / eslint / docs / rules / no-empty-label.md
1 # no-empty-label: disallow labels for anything other than loops and switches
2
3 (removed) This rule was **removed** in ESLint v2.0 and **replaced** by the [no-labels](no-labels.md) rule.
4
5 Labeled statements are only used in conjunction with labeled break and continue statements. ECMAScript has no goto statement.
6
7
8 ## Rule Details
9
10 This error occurs when a label is used to mark a statement that is not an iteration or switch
11
12 Example of **incorrect** code for this rule:
13
14 ```js
15 /*eslint no-empty-label: "error"*/
16
17 labeled:
18 var x = 10;
19 ```
20
21 Example of **correct** code for this rule:
22
23 ```js
24 /*eslint no-empty-label: "error"*/
25
26 labeled:
27 for (var i=10; i; i--) {
28 // ...
29 }
30 ```
31
32 ## When Not To Use It
33
34 If you don't want to be notified about usage of labels, then it's safe to disable this rule.
35
36 ## Related Rules
37
38 * [no-labels](./no-labels.md)
39 * [no-label-var](./no-label-var.md)
40 * [no-unused-labels](./no-unused-labels.md)