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>
1:6 - ID "fooBar" does not match required pattern "/^[a-z0-9-]+$/"

Examples of correct code for this rule:

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

Options

This rule takes and optional object:

{
    "pattern": "kebabcase"
}

Pattern

Either one of the presets or a custom regular expression.