no-labels
Configuration
rslint.config.ts
Rule Details
Disallow labeled statements. Labels tend to be used only rarely and are frowned upon as a remedial form of flow control that is more error prone and harder to understand.
This rule aims to eliminate the use of labeled statements in JavaScript and reports whenever a labeled statement is encountered and whenever break or continue are used with a label.
Examples of incorrect code for this rule:
Examples of correct code for this rule:
Options
allowLoop(boolean, defaultfalse): Whentrue, allows labels attached to loop statements.allowSwitch(boolean, defaultfalse): Whentrue, allows labels attached to switch statements.
Examples of correct code with { "allowLoop": true }:
Examples of correct code with { "allowSwitch": true }: