1 | # number-leading-zero
|
2 |
|
3 | Require or disallow a leading zero for fractional numbers less than 1.
|
4 |
|
5 |
|
6 | ```css
|
7 | a { line-height: 0.5; }
|
8 | /** ↑
|
9 | * This leading zero */
|
10 | ```
|
11 |
|
12 | This rule ignores mixin parameters in Less.
|
13 |
|
14 | The [`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`: `"always"|"never"`
|
19 |
|
20 | ### `"always"`
|
21 |
|
22 | There _must always_ be a leading zero.
|
23 |
|
24 | The following patterns are considered problems:
|
25 |
|
26 |
|
27 | ```css
|
28 | a { line-height: .5; }
|
29 | ```
|
30 |
|
31 |
|
32 | ```css
|
33 | a { transform: translate(2px, .4px); }
|
34 | ```
|
35 |
|
36 | The following patterns are _not_ considered problems:
|
37 |
|
38 |
|
39 | ```css
|
40 | a { line-height: 0.5; }
|
41 | ```
|
42 |
|
43 |
|
44 | ```css
|
45 | a { transform: translate(2px, 0.4px); }
|
46 | ```
|
47 |
|
48 | ### `"never"`
|
49 |
|
50 | There _must never_ be a leading zero.
|
51 |
|
52 | The following patterns are considered problems:
|
53 |
|
54 |
|
55 | ```css
|
56 | a { line-height: 0.5; }
|
57 | ```
|
58 |
|
59 |
|
60 | ```css
|
61 | a { transform: translate(2px, 0.4px); }
|
62 | ```
|
63 |
|
64 | The following patterns are _not_ considered problems:
|
65 |
|
66 |
|
67 | ```css
|
68 | a { line-height: .5; }
|
69 | ```
|
70 |
|
71 |
|
72 | ```css
|
73 | a { transform: translate(2px, .4px); }
|
74 | ```
|