UNPKG

2.44 kBMarkdownView Raw
1# function-name-case
2
3Specify lowercase or uppercase for function names.
4
5<!-- prettier-ignore -->
6```css
7a { width: calc(5% - 10em); }
8/** ↑
9 * This function */
10```
11
12Camel case function names, e.g. `translateX`, are accounted for when the `lower` option is used.
13
14The [`fix` option](../../../docs/user-guide/usage/options.md#fix) can automatically fix all of the problems reported by this rule.
15
16## Options
17
18`string`: `"lower"|"upper"`
19
20### `"lower"`
21
22The following patterns are considered violations:
23
24<!-- prettier-ignore -->
25```css
26a {
27 width: Calc(5% - 10em);
28}
29```
30
31<!-- prettier-ignore -->
32```css
33a {
34 width: cAlC(5% - 10em);
35}
36```
37
38<!-- prettier-ignore -->
39```css
40a {
41 width: CALC(5% - 10em);
42}
43```
44
45<!-- prettier-ignore -->
46```css
47a {
48 background: -WEBKIT-RADIAL-GRADIENT(red, green, blue);
49}
50```
51
52The following patterns are _not_ considered violations:
53
54<!-- prettier-ignore -->
55```css
56a {
57 width: calc(5% - 10em);
58}
59```
60
61<!-- prettier-ignore -->
62```css
63a {
64 background: -webkit-radial-gradient(red, green, blue);
65}
66```
67
68### `"upper"`
69
70The following patterns are considered violations:
71
72<!-- prettier-ignore -->
73```css
74a {
75 width: Calc(5% - 10em);
76}
77```
78
79<!-- prettier-ignore -->
80```css
81a {
82 width: cAlC(5% - 10em);
83}
84```
85
86<!-- prettier-ignore -->
87```css
88a {
89 width: calc(5% - 10em);
90}
91```
92
93<!-- prettier-ignore -->
94```css
95a {
96 background: -webkit-radial-gradient(red, green, blue);
97}
98```
99
100The following patterns are _not_ considered violations:
101
102<!-- prettier-ignore -->
103```css
104a {
105 width: CALC(5% - 10em);
106}
107```
108
109<!-- prettier-ignore -->
110```css
111a {
112 background: -WEBKIT-RADIAL-GRADIENT(red, green, blue);
113}
114```
115
116## Optional secondary options
117
118### `ignoreFunctions: ["/regex-as-string/", /regex/, "non-regex"]`
119
120Ignore case of function names.
121
122For example, with `"lower"`.
123
124Given:
125
126```
127["some-function", "/^get.*$/"]
128```
129
130The following patterns are considered violations:
131
132<!-- prettier-ignore -->
133```css
134a {
135 color: sOmE-FuNcTiOn();
136}
137```
138
139<!-- prettier-ignore -->
140```css
141a {
142 color: some-other-function();
143}
144```
145
146<!-- prettier-ignore -->
147```css
148a {
149 color: GetColor();
150}
151```
152
153<!-- prettier-ignore -->
154```css
155a {
156 color: GET_COLOR();
157}
158```
159
160The following patterns are _not_ considered violations:
161
162<!-- prettier-ignore -->
163```css
164a {
165 display: some-function();
166}
167```
168
169<!-- prettier-ignore -->
170```css
171a {
172 display: getColor();
173}
174```
175
176<!-- prettier-ignore -->
177```css
178a {
179 display: get_color();
180}
181```