Skip to main content

custom-property-pattern

Specify a pattern for custom properties.

a { --foo-: 1px; }
/** ↑
* The pattern of this */

Use this rule to enforce a convention. For example, require:

  • kebab-case names for consistency with the specifications' examples
  • a namespace, e.g. ^foo-, so that a library's properties can't collide with a consumer's

This rule supports 2 message arguments: the custom property name and the configured pattern.

Options​

string​

Specify a regex string not surrounded with "/".

Given:

{
"custom-property-pattern": "foo-.+"
}

The following patterns are considered problems:

:root { --boo-bar: 0; }

The following patterns are not considered problems:

:root { --foo-bar: 0; }