Require a specific ID format (id-pattern)

Requires all IDs to match a given pattern.

Rule details

Examples of incorrect code for this rule:

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

1 error found.

Examples of correct code for this rule:

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


This rule takes and optional object:

  "pattern": "kebabcase"


Either one of the presets or a custom regular expression.