UNPKG

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