Skip to main content

layer-name-pattern

Specify a pattern for layer names.

@layer foo {}
/** ↑
* This layer name */

The message secondary option can accept the arguments of this rule.

Options

regex|string

A string will be translated into a RegExp like so new RegExp(yourString) — so be sure to escape properly.

Given the string:

"^[a-z][a-z0-9.-]*$"

The following patterns are considered problems:

@layer Foo;
@layer foo.Bar {}
@layer foo, Bar {}
@import "foo.css" layer(Bar);

The following patterns are not considered problems:

@layer foo;
@layer foo.bar {}
@layer foo, bar {}
@import "foo.css" layer(bar);