.gitignore added
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / stylelint / lib / rules / indentation / README.md
1 # indentation
2
3 Specify indentation.
4
5 ```css
6    |@media print {
7    |  a {
8    | ↑  background-position: top left,
9    | ↑ ↑  top right;
10    | ↑}↑ ↑
11    |}↑ ↑ ↑
12 /**  ↑ ↑ ↑
13  * The indentation at these three points */
14 ```
15
16 The `--fix` option on the [command line](../../../docs/user-guide/cli.md#autofixing-errors) can automatically fix all of the problems reported by this rule.
17
18 ## Options
19
20 `int|"tab"`, where `int` is the number of spaces
21
22 ### `2`
23
24 Always indent at-rules, rules, comments, declarations, inside parentheses and multi-line values by 2 spaces.
25
26 The following patterns are considered violations:
27
28 ```css
29 @media print {
30 a {
31 background-position: top left,
32 top right;
33 }
34 }
35 ```
36
37 ```css
38 @media print {
39 a {
40   background-position: top left,
41     top right;
42   }
43 }
44 ```
45
46 ```css
47 @media print {
48   a {
49     background-position: top left,
50     top right;
51   }
52 }
53 ```
54
55 ```css
56 @media print {
57   a,
58     b {
59     background-position: top left,
60       top right;
61   }
62 }
63 ```
64
65 ```css
66 a {
67 /* blergh */
68   color: pink;
69 }
70   /* blergh */
71 ```
72
73 ```css
74 @media print,
75 (-webkit-min-device-pixel-ratio: 1.25),
76 (min-resolution: 120dpi) {}
77 ```
78
79 ```css
80 a {
81   color: rgb(
82   255,
83   255,
84   255
85   );
86   top: 0;
87 }
88 ```
89
90 The following patterns are *not* considered violations:
91
92 ```css
93 @media print {
94   a {
95     background-position: top left,
96       top right;
97   }
98 }
99 ```
100
101 ```css
102 @media print {
103   a,
104   b {
105     background-position: top left,
106       top right;
107   }
108 }
109 ```
110
111 ```css
112 a {
113   /* blergh */
114   color: pink;
115 }
116 /* blergh */
117 ```
118
119 ```css
120 @media print,
121   (-webkit-min-device-pixel-ratio: 1.25),
122   (min-resolution: 120dpi) {}
123 ```
124
125 ```css
126 a {
127   color: rgb(
128     255,
129     255,
130     255
131   );
132   top: 0;
133 }
134 ```
135
136 ## Optional secondary options
137
138 ### `indentInsideParens: "twice"|"once-at-root-twice-in-block"`
139
140 By default, *one extra* indentation (of your specified type) is expected after newlines inside parentheses, and the closing parenthesis is expected to have no extra indentation.
141
142 If you would like to change the quantity of extra indentation inside parentheses, use this option.
143
144 `"twice"` means you expect two extra indentations (of your specified type) after newlines inside parentheses, and expect the closing parenthesis to have one extra indentation. For example:
145
146 ```css
147 a {
148   color: rgb(
149       255,
150       255,
151       255
152     );
153   top: 0;
154 }
155 ```
156
157 `"once-at-root-twice-in-block"` means two things: You want the behavior of `"once"`, as documented above, when the parenthetical expression is part of a node that is an immediate descendent of the root — i.e. not inside a block. And you want the behavior of `"twice"`, as documented above, when the parenthetical expression is part of a node that is inside a block. For example, with a SCSS map:
158
159 ```scss
160 $foo: (
161   bar: 1,
162   baz: 2
163 );
164
165 a {
166   color: rgb(
167       255,
168       255,
169       255
170     );
171   top: 0;
172 }
173 ```
174
175 ### `indentClosingBrace: true|false`
176
177 If `true`, the closing brace of a block (rule or at-rule) will be expected at the same indentation level as the block's inner nodes.
178
179 For example, with `indentClosingBrace: true`.
180
181 The following patterns are considered violations:
182
183 ```css
184 a {
185   color: pink;
186 }
187 ```
188
189 ```css
190 @media print {
191   a {
192     color: pink;
193   }
194 }
195 ```
196
197 The following patterns are *not* considered violations:
198
199 ```css
200 a {
201   color: pink;
202   }
203 ```
204
205 ```css
206 @media print {
207   a {
208     color: pink;
209     }
210   }
211 ```
212
213 ### `except: ["block", "param", "value"]`
214
215 Do *not* indent for these things.
216
217 For example, with `2`.
218
219 The following patterns are considered violations:
220
221 ```css
222 @media print,
223   (-webkit-min-device-pixel-ratio: 1.25),
224   (min-resolution: 120dpi) {
225   a {
226     background-position: top left,
227       top right;
228   }
229 }
230 ```
231
232 The following patterns are *not* considered violations:
233
234 ```css
235 @media print,
236 (-webkit-min-device-pixel-ratio: 1.25),
237 (min-resolution: 120dpi) {
238 a {
239 background-position: top left,
240 top right;
241 }
242 }
243 ```
244
245 ### `ignore: ["inside-parens", "param", "value"]`
246
247 #### `"inside-parens"`
248
249 Ignore the indentation inside parentheses.
250
251 For example, with `2`.
252
253 The following patterns are *not* considered violations:
254
255 ```css
256 a {
257   color: rgb(
258 255,
259   255,
260     255
261   );
262   top: 0;
263 }
264 ```
265
266 #### `"param"`
267
268 Ignore the indentation of at-rule params.
269
270 For example, with `2`.
271
272 The following patterns are *not* considered violations:
273
274 ```css
275 @media print,
276   (-webkit-min-device-pixel-ratio: 1.25),
277     (min-resolution: 120dpi) {
278 }
279 ```
280
281 #### `"value"`
282
283 Ignore the indentation of values.
284
285 For example, with `2`.
286
287 The following patterns are *not* considered violations:
288
289 ```css
290 a {
291   background-position: top left,
292 top right,
293   bottom left,
294     bottom right;
295 }
296 ```