Repository: lesshint/lesshint (js)

Issue:
spaceAroundOperator negation of variable
```
@someVar: 13px;

.test {
    margin-left: -@someVar;
}
```
> Warning: styles.less: line 4, col 20, spaceAroundOperator: Operators should be preceded and followed by one space.

Pull request:
spaceAroundOperator shouldn't report negative variables
Closes #179

Patch:
diff --git a/lib/linters/space_around_operator.js b/lib/linters/space_around_operator.js
index 5c848ce..cdd62d8 100644
--- a/lib/linters/space_around_operator.js
+++ b/lib/linters/space_around_operator.js
@@ -34,6 +34,12 @@ module.exports = {
                 return;
             }
 
+            // Ignore variables
+            if (child.value === '-' && (child.raws.before || node.raws.between) &&
+                nextElement.type === 'atword' && !nextElement.raws.before) {
+                return;
+            }
+
             // Ignore font-size/line-height shorthand declaration
             if (node.prop === 'font' && child.value === '/' &&
                 prevElement.type === 'number' && nextElement.type === 'number') {


Test patch:
diff --git a/test/specs/linters/space_around_operator.js b/test/specs/linters/space_around_operator.js
index c0cfdf2..ccf3784 100644
--- a/test/specs/linters/space_around_operator.js
+++ b/test/specs/linters/space_around_operator.js
@@ -114,6 +114,16 @@ describe('lesshint', function () {
                 });
             });
 
+            it('should not report on negative variables. See #179', function () {
+                var source = 'margin-left: -@foo;';
+
+                return spec.parse(source, function (ast) {
+                    var result = spec.linter.lint(options, ast.root.first);
+
+                    expect(result).to.be.undefined;
+                });
+            });
+
             it('should not report on font-size/line-height shorthand declaration', function () {
                 var source = 'font: 12px/1.5 Arial;';