1 | # function-comma-newline-before
|
2 |
|
3 | Require a newline or disallow whitespace before the commas of functions.
|
4 |
|
5 |
|
6 | ```css
|
7 | a { transform: translate(1
|
8 | , 1) }
|
9 | /** ↑
|
10 | * This comma */
|
11 | ```
|
12 |
|
13 | The [`fix` option](../../../docs/user-guide/usage/options.md#fix) can automatically fix all of the problems reported by this rule.
|
14 |
|
15 | ## Options
|
16 |
|
17 | `string`: `"always"|"always-multi-line"|"never-multi-line"`
|
18 |
|
19 | ### `"always"`
|
20 |
|
21 | There _must always_ be a newline before the commas.
|
22 |
|
23 | The following patterns are considered violations:
|
24 |
|
25 |
|
26 | ```css
|
27 | a { transform: translate(1,1) }
|
28 | ```
|
29 |
|
30 |
|
31 | ```css
|
32 | a { transform: translate(1 ,1) }
|
33 | ```
|
34 |
|
35 |
|
36 | ```css
|
37 | a { transform: translate(1,
|
38 | 1) }
|
39 | ```
|
40 |
|
41 | The following patterns are _not_ considered violations:
|
42 |
|
43 |
|
44 | ```css
|
45 | a {
|
46 | transform: translate(1
|
47 | ,1)
|
48 | }
|
49 | ```
|
50 |
|
51 |
|
52 | ```css
|
53 | a {
|
54 | transform: translate(1
|
55 | , 1)
|
56 | }
|
57 | ```
|
58 |
|
59 | ### `"always-multi-line"`
|
60 |
|
61 | There _must always_ be a newline before the commas in multi-line functions.
|
62 |
|
63 | The following patterns are considered violations:
|
64 |
|
65 |
|
66 | ```css
|
67 | a { transform: translate(1,
|
68 | 1) }
|
69 | ```
|
70 |
|
71 | The following patterns are _not_ considered violations:
|
72 |
|
73 |
|
74 | ```css
|
75 | a { transform: translate(1,1) }
|
76 | ```
|
77 |
|
78 |
|
79 | ```css
|
80 | a { transform: translate(1 ,1) }
|
81 | ```
|
82 |
|
83 |
|
84 | ```css
|
85 | a {
|
86 | transform: translate(1
|
87 | ,1)
|
88 | }
|
89 | ```
|
90 |
|
91 |
|
92 | ```css
|
93 | a {
|
94 | transform: translate(1
|
95 | , 1)
|
96 | }
|
97 | ```
|
98 |
|
99 | ### `"never-multi-line"`
|
100 |
|
101 | There _must never_ be whitespace before the commas in multi-line functions.
|
102 |
|
103 | The following patterns are considered violations:
|
104 |
|
105 |
|
106 | ```css
|
107 | a { transform: translate(1 ,
|
108 | 1) }
|
109 | ```
|
110 |
|
111 | The following patterns are _not_ considered violations:
|
112 |
|
113 |
|
114 | ```css
|
115 | a { transform: translate(1 ,1) }
|
116 | ```
|
117 |
|
118 |
|
119 | ```css
|
120 | a { transform: translate(1 , 1) }
|
121 | ```
|
122 |
|
123 |
|
124 | ```css
|
125 | a {
|
126 | transform: translate(1,
|
127 | 1)
|
128 | }
|
129 | ```
|