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