Repository: sasstools/sass-lint (js)

Issue:
sass-lint:disable-next-line
At the moment, you can do:

```sass
overflow-x: scroll !important; // sass-lint:disable-line no-important
```

Or:

```sass
// sass-lint:disable no-important
overflow-x: scroll !important;
// sass-lint:enable no-important
```

The first is not ideal when you want to add a reason/description and the line is already quite long, and the second is unnecessarily verbose.

TSLint supports a `tslint:disable-next-line` alternative, which would look like this:

```sass
// sass-lint:disable-next-line no-important -- The reason for this is because ...
overflow-x: scroll !important;
```

It would be nice to have this option.

Pull request:
Add disable-next-line
<!--
## New Pull Request Information

Please make sure you have read through our [contribution guidelines](https://github.com/sasstools/sass-lint/blob/develop/CONTRIBUTING.md#pull-requests) before submitting a pull request.

Most importantly your pull request should provide information on what the changes do and they should reference an already created issue. e.g. 'Fixes #80' for bugs and 'Closes #90' for other issues.

Please use the headings below as guidance, you don't need to answer them point for point but the contents give you an idea of what we'd like to know about your PR.

You must also include your agreement to the developer certificate of origin below.

-->

**What do the changes you have made achieve?**

Closes #995 

**Are there any new warning messages?**

No

**Have you written tests?**

Yes

**Have you included relevant documentation**

Yes

**Which issues does this resolve?**

#995 

`<DCO 1.1 Signed-off-by: Anna Szwemin anna.szwemin@gmail.com>`


Patch:
diff --git a/README.md b/README.md
index eb49c78..900b26d 100644
--- a/README.md
+++ b/README.md
@@ -79,7 +79,7 @@ For all [rules](https://github.com/sasstools/sass-lint/tree/master/docs/rules),
 
 If you want to configure options, set the rule to an array, where the first item in the array is the severity, and the second item in the array is an object including the options you would like to set.
 
-Here is an example configuration of a rule, where we are specifying that breaking the [indentation rule](https://github.com/sasstools/sass-lint/blob/master/docs/rules/indentation.md) should be treated as an error (its severity set to two), and setting the `size` option of the rule to 2 spaces:  
+Here is an example configuration of a rule, where we are specifying that breaking the [indentation rule](https://github.com/sasstools/sass-lint/blob/master/docs/rules/indentation.md) should be treated as an error (its severity set to two), and setting the `size` option of the rule to 2 spaces:
 
 ```yml
 rules:
@@ -127,6 +127,15 @@ p {
 }
 ```
 
+### Disable a rule for text next line
+
+```scss
+p {
+  // sass-lint:disable-next-line border-zero
+  border: none;
+}
+```
+
 ### Disable all lints within a block (and all contained blocks)
 
 ```scss
diff --git a/docs/toggle-rules-in-src.md b/docs/toggle-rules-in-src.md
index 05e5ba7..c5755d9 100644
--- a/docs/toggle-rules-in-src.md
+++ b/docs/toggle-rules-in-src.md
@@ -29,6 +29,15 @@ p {
 }
 ```
 
+## Disable a rule for the next line
+
+```scss
+p {
+  // sass-lint:disable-next-line border-zero
+  border: none;
+}
+```
+
 ## Disable all lints within a block (and all contained blocks)
 
 ```scss
diff --git a/lib/ruleToggler.js b/lib/ruleToggler.js
index f4bbd52..844bb27 100644
--- a/lib/ruleToggler.js
+++ b/lib/ruleToggler.js
@@ -196,6 +196,9 @@ module.exports.getToggledRules = function (ast) {
     case 'sass-lint:disable-line':
       addDisableLine(toggledRules, rules, comment.start.line);
       break;
+    case 'sass-lint:disable-next-line':
+      addDisableLine(toggledRules, rules, comment.start.line + 1);
+      break;
     default:
       return;
     }


Test patch:
diff --git a/tests/ruleToggler.js b/tests/ruleToggler.js
index 354da08..c4bd4da 100644
--- a/tests/ruleToggler.js
+++ b/tests/ruleToggler.js
@@ -68,6 +68,15 @@ describe('rule toggling', function () {
         }
       }) === true);
     });
+    it('should be able to disable next line', function () {
+      var ruleToggles = generateToggledRules('ruleToggler-disable-next-line.scss');
+      assert(deepEqual(ruleToggles, {
+        globalEnable: [],
+        ruleEnable: {
+          a: [[false, 3, 1], [true, 4, 1]]
+        }
+      }) === true);
+    });
     it('should be able to disable a block of code', function () {
       var ruleToggles = generateToggledRules('ruleToggler-disable-a-block.scss');
       assert(deepEqual(ruleToggles, {
diff --git a/tests/sass/ruleToggler-disable-next-line.sass b/tests/sass/ruleToggler-disable-next-line.sass
new file mode 100644
index 0000000..cfbbd9d
--- /dev/null
+++ b/tests/sass/ruleToggler-disable-next-line.sass
@@ -0,0 +1,3 @@
+p
+    // sass-lint:disable-next-line a
+    border-color: red
diff --git a/tests/sass/ruleToggler-disable-next-line.scss b/tests/sass/ruleToggler-disable-next-line.scss
new file mode 100644
index 0000000..35544ba
--- /dev/null
+++ b/tests/sass/ruleToggler-disable-next-line.scss
@@ -0,0 +1,4 @@
+p {
+    // sass-lint:disable-next-line a
+    border-color: red;
+}