Repository: lesshint/lesshint (js)

Issue:
Operators shouldnt be preceded and  followed by one space if this operator is not an operator but just a char.
**Which version of `lesshint` are you using?**

last one

**How are you running `lesshint`? CLI, Node.js API, Grunt/Gulp plugin?**

gulp-lesslint

**What's your `.lesshintrc` configuration?**

vanilla

**If you're reporting a bug, please show us some code that's failing.**

```less
        margin-right: -(@grid-gutter-width / 4);
```

**What did you expect to happen?**

    {nothing}

**What's the actual result?**

    Warning: tables.less: line 13, col 25, spaceAroundOperator: Operators should be preceded and followed by one space.

**Would you be interested in submitting a PR for this issue?**

Why not


----

alternativ:

`@grid-whatever-width` shouldn't be allowed as name at all...


Pull request:
Allow negative values before a (. Close #349
**Which issue, if any, does this resolve?**
Solve #349 

```css
h {
    margin-left: -(1px); // fails
}
```
**Is there anything in this PR that needs extra explaining or should something specific be focused on?**

Nope. A lot of copy/paste code in the test section.

I am not sure about my changes. Any help is welcome!

Patch:
diff --git a/lib/linters/space_around_operator.js b/lib/linters/space_around_operator.js
index 830763e..1038e13 100644
--- a/lib/linters/space_around_operator.js
+++ b/lib/linters/space_around_operator.js
@@ -24,12 +24,12 @@ module.exports = {
             const nextElement = child.parent.nodes[index + 1];
             const prevElement = child.parent.nodes[index - 1];
 
+
             // Ignore negative numbers
             if (child.value === '-' && (child.raws.before || node.raws.between) &&
-                nextElement.type === 'number' && !nextElement.raws.before) {
+                (nextElement.type === 'number' || nextElement.value === '(') && !nextElement.raws.before) {
                 return;
             }
-
             // Ignore variables
             if (child.value === '-' && (child.raws.before || node.raws.between) &&
                 nextElement.type === 'atword' && !nextElement.raws.before) {


Test patch:
diff --git a/test/specs/linters/space_around_operator.js b/test/specs/linters/space_around_operator.js
index d67819e..6578500 100644
--- a/test/specs/linters/space_around_operator.js
+++ b/test/specs/linters/space_around_operator.js
@@ -84,6 +84,16 @@ describe('lesshint', function () {
                 });
             });
 
+            it('should not report on negative values before a (', function () {
+                const source = 'margin-left: -(10px);';
+
+                return spec.parse(source, function (ast) {
+                    const result = spec.linter.lint(options, ast.root.first);
+
+                    expect(result).to.be.undefined;
+                });
+            });
+
             it('should not report on negative values in shorthands', function () {
                 const source = 'margin: -10px -1px 0px 20px;';