# useNamedLayer

Rule `biome/useNamedLayer`. Disallow anonymous cascade layers.

- 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: #1961 by reach

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| Biome | `nursery/useNamedLayer` | no | no | group nursery, since 2.5.9 | [docs](https://biomejs.dev/linter/rules/use-named-layer/) |

## Code examples

### Incorrect: the rule reports this

```css
@layer {
  a {
    color: red;
  }
}
```

```css
@import "theme.css" layer;
```

### Correct: the rule accepts this

```css
@layer base {
  a {
    color: red;
  }
}
```

```css
@import "theme.css" layer(base);
```

Examples from the Biome documentation.

## Enable it

### Biome: `biome.json`

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

## Related rules

- [biome/useLogicalProperties](https://lintradar.dev/rules/biome/useLogicalProperties.md): Prefer logical CSS properties over physical properties.
- [biome/usePackageJsonCpu](https://lintradar.dev/rules/biome/usePackageJsonCpu.md): Require the `cpu` field in `package.json`.
- [biome/useLayeredStyles](https://lintradar.dev/rules/biome/useLayeredStyles.md): Enforce style rules to be defined within a cascade layer.
- [biome/usePackageJsonEngines](https://lintradar.dev/rules/biome/usePackageJsonEngines.md): Require the `engines` field in `package.json`.
- [biome/useJsonImportAttributes](https://lintradar.dev/rules/biome/useJsonImportAttributes.md): Enforces the use of `with { type: "json" }` for JSON module imports.
- [biome/useReactCompiler](https://lintradar.dev/rules/biome/useReactCompiler.md): Validate files with React Compiler.

---

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