1 | # selector-type-no-unknown
|
2 |
|
3 | Disallow unknown type selectors.
|
4 |
|
5 | ```css
|
6 | unknown {}
|
7 | /** ↑
|
8 | * This type selector */
|
9 | ```
|
10 |
|
11 | This rule considers tags defined in the HTML, SVG, and MathML specifications to be known.
|
12 |
|
13 | ## Options
|
14 |
|
15 | ### `true`
|
16 |
|
17 | The following patterns are considered violations:
|
18 |
|
19 | ```css
|
20 | unknown {}
|
21 | ```
|
22 |
|
23 | ```css
|
24 | tag {}
|
25 | ```
|
26 |
|
27 | The following patterns are *not* considered violations:
|
28 |
|
29 | ```css
|
30 | input {}
|
31 | ```
|
32 |
|
33 | ```css
|
34 | ul li {}
|
35 | ```
|
36 |
|
37 | ```css
|
38 | li > a {}
|
39 | ```
|
40 |
|
41 | ## Optional secondary options
|
42 |
|
43 | ### `ignore: ["custom-elements", "default-namespace"]`
|
44 |
|
45 | #### `"custom-elements"`
|
46 |
|
47 | Allow custom elements.
|
48 |
|
49 | The following patterns are considered violations:
|
50 |
|
51 | ```css
|
52 | unknown {}
|
53 | ```
|
54 |
|
55 | ```css
|
56 | x-Foo {}
|
57 | ```
|
58 |
|
59 | The following patterns are *not* considered violations:
|
60 |
|
61 | ```css
|
62 | x-foo {}
|
63 | ```
|
64 |
|
65 | #### `"default-namespace"`
|
66 |
|
67 | Allow unknown type selectors if they belong to the default namespace.
|
68 |
|
69 | The following patterns are considered violations:
|
70 |
|
71 | ```css
|
72 | namespace|unknown {}
|
73 | ```
|
74 |
|
75 | The following patterns are *not* considered violations:
|
76 |
|
77 | ```css
|
78 | unknown {}
|
79 | ```
|
80 |
|
81 | ### `ignoreNamespaces: ["/regex/", /regex/, "string"]`
|
82 |
|
83 | Given:
|
84 |
|
85 | ```js
|
86 | ["/^my-/", "custom-namespace"]
|
87 | ```
|
88 |
|
89 | The following patterns are *not* considered violations:
|
90 |
|
91 | ```css
|
92 | custom-namespace|unknown {}
|
93 | ```
|
94 |
|
95 | ```css
|
96 | my-namespace|unknown {}
|
97 | ```
|
98 |
|
99 | ```css
|
100 | my-other-namespace|unknown {}
|
101 | ```
|
102 |
|
103 | ### `ignoreTypes: ["/regex/", /regex/, "string"]`
|
104 |
|
105 | Given:
|
106 |
|
107 | ```js
|
108 | ["/^my-/", "custom-type"]
|
109 | ```
|
110 |
|
111 | The following patterns are *not* considered violations:
|
112 |
|
113 | ```css
|
114 | custom-type {}
|
115 | ```
|
116 |
|
117 | ```css
|
118 | my-type {}
|
119 | ```
|
120 |
|
121 | ```css
|
122 | my-other-type {}
|
123 | ```
|