Skip to content

noUnknownTypeSelector (CSS)

Language CSS
biome.json
{
"linter": {
"rules": {
"correctness": {
"noUnknownTypeSelector": "error"
}
}
}
}

Disallow unrecognized element names in type selectors.

A type selector targets elements by tag name, as in button {}. Names from the HTML, SVG, and MathML specifications are recognized. Valid custom-element names such as x-button are also allowed.

See the MDN type-selector reference and the element references for HTML, SVG, and MathML.

unknown {}
code-block.css:1:1 lint/correctness/noUnknownTypeSelector ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

✖ Unknown type selector is not allowed.

> 1 │ unknown {}
│ ^^^^^^^
2 │

ℹ See MDN web docs for more details.

ℹ Consider replacing the unknown type selector with valid one.

unknown > ul {}
code-block.css:1:1 lint/correctness/noUnknownTypeSelector ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

✖ Unknown type selector is not allowed.

> 1 │ unknown > ul {}
│ ^^^^^^^
2 │

ℹ See MDN web docs for more details.

ℹ Consider replacing the unknown type selector with valid one.

x-Foo {}
code-block.css:1:1 lint/correctness/noUnknownTypeSelector ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

✖ Unknown type selector is not allowed.

> 1 │ x-Foo {}
│ ^^^^^
2 │

ℹ See MDN web docs for more details.

ℹ Consider replacing the unknown type selector with valid one.

input {}
ul > li {}
x-foo {}