# noSelfNestedLayer

Rule `biome/noSelfNestedLayer`. Disallow nesting a cascade layer inside a layer with the same name.

- Source: biome
- Technologies: CSS
- Kind: style
- Needs type information: no
- Autofix: no
- Reach: 0 weekly downloads of presets that enable it
- Trend: 0% last quarter
- Rank: #1937 by reach

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| Biome | `nursery/noSelfNestedLayer` | no | no | group nursery, since 2.6.3 | [docs](https://biomejs.dev/linter/rules/no-self-nested-layer/) |

## Code examples

### Incorrect: the rule reports this

```css
@layer components {
  @layer components {
    .button {
      color: red;
    }
  }
}
```

```css
@layer base {
  @layer base.reset {
    * {
      margin: 0;
    }
  }
}
```

### Correct: the rule accepts this

```css
@layer base {
  @layer reset {
    * {
      margin: 0;
    }
  }
}
```

Examples from the Biome documentation.

## Enable it

### Biome: `biome.json`

```json
{
  "linter": {
    "rules": {
      "nursery": {
        "noSelfNestedLayer": "error"
      }
    }
  }
}
```

## Related rules

- [biome/noSecrets](https://lintradar.dev/rules/biome/noSecrets.md): Disallow usage of sensitive data such as API keys and tokens.
- [biome/noShortTimeValues](https://lintradar.dev/rules/biome/noShortTimeValues.md): Disallow animation and transition times that are shorter than a configured minimum.
- [biome/noScssDeprecatedColorFunctions](https://lintradar.dev/rules/biome/noScssDeprecatedColorFunctions.md): Disallow the deprecated Sass functions that read one channel of a color.
- [biome/noSolidDestructuredProps](https://lintradar.dev/rules/biome/noSolidDestructuredProps.md): Disallow destructuring props inside JSX components in Solid projects.
- [biome/noRestrictedDependencies](https://lintradar.dev/rules/biome/noRestrictedDependencies.md): Disallow dependencies that are known to have better alternatives.
- [biome/noSvelteIgnoredUnsubscribe](https://lintradar.dev/rules/biome/noSvelteIgnoredUnsubscribe.md): Disallow ignoring the function returned by a store's `subscribe()` method.

---

Web page: https://lintradar.dev/rules/biome/noSelfNestedLayer. Data from npm and the linters' documentation, collected Dec 4, 2026. Site guide for agents: https://lintradar.dev/llms.txt
