Require a specific class format (class-pattern)

Requires all classes to match a given pattern.

Rule details

Examples of incorrect code for this rule:

<div class="fooBar"></foobar>
error: Class "fooBar" does not match required pattern "/^[a-z0-9-]+$/" (class-pattern) at inline:1:13:
> 1 | <div class="fooBar"></foobar>
    |             ^^^^^^


1 error found.

Examples of correct code for this rule:

<div class="foo-bar"></div>

Options

This rule takes and optional object:

{
  "pattern": "kebabcase"
}

Pattern

Either one of the presets or a custom regular expression.