Repository: lesshint/lesshint (js)

Issue:
decimalZero 2.0 bugs
actual `master` branch

```css
.test-rule {
    font-family: ForalPro, sans-serif;
    font-style: normal;
    font-weight: 300;
}
```
> Warning: foral-pro.less: line 1, col 18, decimalZero: 300 should be written without leading and trailing zero.

second problem: `line 1`, should be `4`

Same with:
```css
@font-size-base: 1rem;
```
```css
.tags-view {
    font-size: (15 * @base);
}
```

Pull request:
fixes #196: decimalZero false positive with whole numbers and 'none' …
…style

Patch:
diff --git a/lib/linters/decimal_zero.js b/lib/linters/decimal_zero.js
index 32359eb..2eb76dd 100644
--- a/lib/linters/decimal_zero.js
+++ b/lib/linters/decimal_zero.js
@@ -23,7 +23,7 @@ module.exports = {
 
             number = child.value;
 
-            // Bail if it's a float parsed as 0 (e.g. 0.0, .0, 0.)
+            // If it's a float parsed as 0 (e.g. 0.0, .0, 0.), bail.
             if (parseFloat(number) === 0) {
                 return;
             }
@@ -53,7 +53,7 @@ module.exports = {
 
                     break;
                 case 'none':
-                    if (!/^-?([1-9]\d*)?\.(\d*[1-9])$/.test(number)) {
+                    if (/\./.test(number) && !/^-?([1-9]\d*)?\.(\d*[1-9])$/.test(number)) {
                         output.type = 'leading and trailing';
                         output.inclusion = 'without';
                     }


Test patch:
diff --git a/test/specs/linters/decimal_zero.js b/test/specs/linters/decimal_zero.js
index 165b7dd..d6920a9 100644
--- a/test/specs/linters/decimal_zero.js
+++ b/test/specs/linters/decimal_zero.js
@@ -250,6 +250,16 @@ describe('lesshint', function () {
                     expect(result).to.deep.equal(expected);
                 });
             });
+
+            it('should allow font-weights ending in zero', function () {
+                var source = 'font-weight: 300;';
+
+                return spec.parse(source, function (ast) {
+                    var result = spec.linter.lint(options, ast.root.first);
+
+                    expect(result).to.be.undefined;
+                });
+            });
         }); //"none"
 
         describe('with invalid "style" value', function () {