1 | # selector-no-qualifying-type
|
2 |
|
3 | Disallow qualifying a selector by type.
|
4 |
|
5 | ```css
|
6 | a.foo {}
|
7 | /** ↑
|
8 | * This type selector is qualifying the class */
|
9 | ```
|
10 |
|
11 | A type selector is "qualifying" when it is compounded with (chained to) another selector (e.g. `a.foo`, `a#foo`). This rule does not regulate type selectors that are combined with other selectors via a combinator (e.g. `a > .foo`, `a #foo`).
|
12 |
|
13 | ## Options
|
14 |
|
15 | ### `true`
|
16 |
|
17 | The following patterns are considered violations:
|
18 |
|
19 | ```css
|
20 | a.foo {
|
21 | margin: 0
|
22 | }
|
23 | ```
|
24 |
|
25 | ```css
|
26 | a#foo {
|
27 | margin: 0
|
28 | }
|
29 | ```
|
30 |
|
31 | ```css
|
32 | input[type='button'] {
|
33 | margin: 0
|
34 | }
|
35 | ```
|
36 |
|
37 | The following patterns are *not* considered violations:
|
38 |
|
39 | ```css
|
40 | .foo {
|
41 | margin: 0
|
42 | }
|
43 | ```
|
44 |
|
45 | ```css
|
46 | #foo {
|
47 | margin: 0
|
48 | }
|
49 | ```
|
50 |
|
51 | ```css
|
52 | input {
|
53 | margin: 0
|
54 | }
|
55 | ```
|
56 |
|
57 | ## Optional secondary options
|
58 |
|
59 | ### `ignore: ["attribute", "class", "id"]`
|
60 |
|
61 | #### `"attribute"`
|
62 |
|
63 | Allow attribute selectors qualified by type.
|
64 |
|
65 | The following patterns are *not* considered violations:
|
66 |
|
67 | ```css
|
68 | input[type='button'] {
|
69 | margin: 0
|
70 | }
|
71 | ```
|
72 |
|
73 | #### `"class"`
|
74 |
|
75 | Allow class selectors qualified by type.
|
76 |
|
77 | The following patterns are *not* considered violations:
|
78 |
|
79 | ```css
|
80 | a.foo {
|
81 | margin: 0
|
82 | }
|
83 | ```
|
84 |
|
85 | #### `"id"`
|
86 |
|
87 | Allow ID selectors qualified by type.
|
88 |
|
89 | The following patterns are *not* considered violations:
|
90 |
|
91 | ```css
|
92 | a#foo {
|
93 | margin: 0
|
94 | }
|
95 | ```
|