Skip to content

noUndeclaredCustomProperties (HTML)

biome.json
{
"linter": {
"rules": {
"nursery": {
"noUndeclaredCustomProperties": "error"
}
}
}
}

Disallow undeclared CSS custom properties in inline styles.

A custom property has a name beginning with -- and is read with var(--name). The rule checks static style attributes and looks for a matching declaration on the same element, an ancestor element, or a stylesheet available to the file. An unresolved name usually means the declaration is missing or misspelled.

<div style="color: var(--text-color)"></div>
code-block.html:1:24 lint/nursery/noUndeclaredCustomProperties ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

ℹ The custom property --text-color is not defined.

> 1 │ <div style="color: var(--text-color)"></div>
│ ^^^^^^^^^^^^
2 │

ℹ An undeclared custom property can indicate a misspelled name or a missing declaration.

ℹ Define the custom property in an available stylesheet, rename it or remove it.

ℹ This rule belongs to the nursery group, which means it is not yet stable and may change in the future. Visit https://biomejs.dev/linter/#nursery for more information.

<div style="--text-color: blue; color: var(--text-color)"></div>