UNPKG

939 BMarkdownView Raw
1# function-calc-no-unspaced-operator
2
3Disallow an unspaced operator within `calc` functions.
4
5<!-- prettier-ignore -->
6```css
7a { top: calc(1px + 2px); }
8/** ↑
9 * The space around this operator */
10```
11
12Before 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
18The following patterns are considered violations:
19
20<!-- prettier-ignore -->
21```css
22a { top: calc(1px+2px); }
23```
24
25<!-- prettier-ignore -->
26```css
27a { top: calc(1px+ 2px); }
28```
29
30The following patterns are _not_ considered violations:
31
32<!-- prettier-ignore -->
33```css
34a { top: calc(1px + 2px); }
35```
36
37<!-- prettier-ignore -->
38```css
39a { top: calc(calc(1em * 2) / 3); }
40```
41
42<!-- prettier-ignore -->
43```css
44a {
45 top: calc(var(--foo) +
46 var(--bar));
47}
48```
49
50<!-- prettier-ignore -->
51```css
52a {
53 top: calc(var(--foo)
54 + var(--bar));
55}
56```