1 | # function-calc-no-unspaced-operator
|
2 |
|
3 | Disallow an unspaced operator within `calc` functions.
|
4 |
|
5 |
|
6 | ```css
|
7 | a { top: calc(1px + 2px); }
|
8 | /** ↑
|
9 | * The space around this operator */
|
10 | ```
|
11 |
|
12 | Before the operator, there must be a single whitespace or a newline plus indentation. After the operator, there must be a single whitespace or a newline.
|
13 |
|
14 | ## Options
|
15 |
|
16 | ### `true`
|
17 |
|
18 | The following patterns are considered violations:
|
19 |
|
20 |
|
21 | ```css
|
22 | a { top: calc(1px+2px); }
|
23 | ```
|
24 |
|
25 |
|
26 | ```css
|
27 | a { top: calc(1px+ 2px); }
|
28 | ```
|
29 |
|
30 | The following patterns are _not_ considered violations:
|
31 |
|
32 |
|
33 | ```css
|
34 | a { top: calc(1px + 2px); }
|
35 | ```
|
36 |
|
37 |
|
38 | ```css
|
39 | a { top: calc(calc(1em * 2) / 3); }
|
40 | ```
|
41 |
|
42 |
|
43 | ```css
|
44 | a {
|
45 | top: calc(var(--foo) +
|
46 | var(--bar));
|
47 | }
|
48 | ```
|
49 |
|
50 |
|
51 | ```css
|
52 | a {
|
53 | top: calc(var(--foo)
|
54 | + var(--bar));
|
55 | }
|
56 | ```
|