Skip to content

noUndeclaredCustomProperties (CSS)

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

Reports custom properties used with var() that have no visible declaration.

This rule checks custom properties defined by declarations such as --theme: blue, registrations such as @property --theme, imported stylesheets, linked stylesheets, and <style> blocks in HTML-like files. Files that aren’t imported by the project aren’t analyzed.

Locally scoped styles in Vue, Svelte, and Astro are visible only within their component. Global styles can provide custom properties to imported child components.

invalid.css
a {
color: var(--link-color);
}
valid.css
:root {
--link-color: blue;
}
a {
color: var(--link-color);
}