1 | # number-leading-zero
|
2 |
|
3 | Require or disallow a leading zero for fractional numbers less than 1.
|
4 |
|
5 | ```css
|
6 | a { line-height: 0.5; }
|
7 | /** ↑
|
8 | * This leading zero */
|
9 | ```
|
10 |
|
11 | This rule ignores mixin parameters in Less.
|
12 |
|
13 | The `--fix` option on the [command line](../../../docs/user-guide/cli.md#autofixing-errors) can automatically fix all of the problems reported by this rule.
|
14 |
|
15 | ## Options
|
16 |
|
17 | `string`: `"always"|"never"`
|
18 |
|
19 | ### `"always"`
|
20 |
|
21 | There *must always* be a leading zero.
|
22 |
|
23 | The following patterns are considered violations:
|
24 |
|
25 | ```css
|
26 | a { line-height: .5; }
|
27 | ```
|
28 |
|
29 | ```css
|
30 | a { transform: translate(2px, .4px); }
|
31 | ```
|
32 |
|
33 | The following patterns are *not* considered violations:
|
34 |
|
35 | ```css
|
36 | a { line-height: 0.5; }
|
37 | ```
|
38 |
|
39 | ```css
|
40 | a { transform: translate(2px, 0.4px); }
|
41 | ```
|
42 |
|
43 | ### `"never"`
|
44 |
|
45 | There *must never* be a leading zero.
|
46 |
|
47 | The following patterns are considered violations:
|
48 |
|
49 | ```css
|
50 | a { line-height: 0.5; }
|
51 | ```
|
52 |
|
53 | ```css
|
54 | a { transform: translate(2px, 0.4px); }
|
55 | ```
|
56 |
|
57 | The following patterns are *not* considered violations:
|
58 |
|
59 | ```css
|
60 | a { line-height: .5; }
|
61 | ```
|
62 |
|
63 | ```css
|
64 | a { transform: translate(2px, .4px); }
|
65 | ```
|