Skip to main content

selector-type-no-unknown

Disallow unknown type selectors.

    unknown {}
/** ↑
* This type selector */

This rule considers tags defined in the HTML, SVG, and MathML specifications to be known.

The message secondary option can accept the arguments of this rule.

Options

true

The following patterns are considered problems:

unknown {}
tag {}

The following patterns are not considered problems:

input {}
ul li {}
li > a {}

Optional secondary options

ignore: ["custom-elements", "default-namespace"]

"custom-elements"

Allow custom elements.

The following patterns are considered problems:

unknown {}
x-Foo {}

The following patterns are not considered problems:

x-foo {}

"default-namespace"

Allow unknown type selectors if they belong to the default namespace.

The following patterns are considered problems:

namespace|unknown {}

The following patterns are not considered problems:

unknown {}

ignoreNamespaces: ["/regex/", /regex/, "string"]

Given:

["/^my-/", "custom-namespace"]

The following patterns are not considered problems:

custom-namespace|unknown {}
my-namespace|unknown {}
my-other-namespace|unknown {}

ignoreTypes: ["/regex/", /regex/, "string"]

Given:

["/^my-/", "custom-type"]

The following patterns are not considered problems:

custom-type {}
my-type {}
my-other-type {}