noUnknownTypeSelector
Summary
Section titled “Summary”- Rule available since:
v1.9.4
- Diagnostic Category:
lint/correctness/noUnknownTypeSelector
- This rule is recommended, which means is enabled by default.
- This rule doesn’t have a fix.
- The default severity of this rule is error.
- Sources:
Description
Section titled “Description”Disallow unknown type selectors.
This rule considers tags defined in the HTML, SVG, and MathML specifications to be known. For details on known CSS type selectors, see the following links
- https://developer.mozilla.org/en-US/docs/Web/CSS/Type_selectors
- https://developer.mozilla.org/ja/docs/Web/HTML/Element
- https://developer.mozilla.org/ja/docs/Web/SVG/Element
- https://developer.mozilla.org/ja/docs/Web/MathML/Element
This rule allows custom elements.
Examples
Section titled “Examples”Invalid
Section titled “Invalid”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 {}
How to configure
Section titled “How to configure”{ "linter": { "rules": { "correctness": { "noUnknownTypeSelector": "error" } } }}