> 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-extra-label

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


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

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

## Rule Details

This rule disallows labels that are only used on loops or switch statements
that have no nested breakable statement — in those cases a bare `break` /
`continue` already refers to the directly-enclosing loop or switch, so the
label adds no information and can confuse readers who expect labels to
control deeper nesting.

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

```javascript
A: while (a) {
    break A;
}

B: for (let i = 0; i < 10; ++i) {
    break B;
}

C: switch (a) {
    case 0:
        break C;
}
```

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

```javascript
while (a) {
    break;
}

A: {
    break A;
}

B: while (a) {
    while (b) {
        break B;
    }
}

C: switch (a) {
    case 0:
        while (b) {
            break C;
        }
}
```

## Options

This rule has no options.

## Original Documentation

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