UNPKG

1.67 kBMarkdownView Raw
1# selector-attribute-brackets-space-inside
2
3Require a single space or disallow whitespace on the inside of the brackets within attribute selectors.
4
5<!-- prettier-ignore -->
6```css
7 [ target=_blank ]
8/** ↑ ↑
9 * The space inside these two brackets */
10```
11
12The [`fix` option](../../../docs/user-guide/usage/options.md#fix) can automatically fix all of the problems reported by this rule.
13
14## Options
15
16`string`: `"always"|"never"`
17
18### `"always"`
19
20There _must always_ be a single space inside the brackets.
21
22The following patterns are considered violations:
23
24<!-- prettier-ignore -->
25```css
26[target] {}
27```
28
29<!-- prettier-ignore -->
30```css
31[ target] {}
32```
33
34<!-- prettier-ignore -->
35```css
36[target ] {}
37```
38
39<!-- prettier-ignore -->
40```css
41[target=_blank] {}
42```
43
44<!-- prettier-ignore -->
45```css
46[ target=_blank] {}
47```
48
49<!-- prettier-ignore -->
50```css
51[target=_blank ] {}
52```
53
54The following patterns are _not_ considered violations:
55
56<!-- prettier-ignore -->
57```css
58[ target ] {}
59```
60
61<!-- prettier-ignore -->
62```css
63[ target=_blank ] {}
64```
65
66### `"never"`
67
68There _must never_ be whitespace on the inside the brackets.
69
70The following patterns are considered violations:
71
72<!-- prettier-ignore -->
73```css
74[ target] {}
75```
76
77<!-- prettier-ignore -->
78```css
79[target ] {}
80```
81
82<!-- prettier-ignore -->
83```css
84[ target ] {}
85```
86
87<!-- prettier-ignore -->
88```css
89[ target=_blank] {}
90```
91
92<!-- prettier-ignore -->
93```css
94[target=_blank ] {}
95```
96
97<!-- prettier-ignore -->
98```css
99[ target=_blank ] {}
100```
101
102The following patterns are _not_ considered violations:
103
104<!-- prettier-ignore -->
105```css
106[target] {}
107```
108
109<!-- prettier-ignore -->
110```css
111[target=_blank] {}
112```