diff --git a/lib/rules/trailing-semicolon.js b/lib/rules/trailing-semicolon.js index ed9c419f..1f2e1c51 100644 --- a/lib/rules/trailing-semicolon.js +++ b/lib/rules/trailing-semicolon.js @@ -10,6 +10,21 @@ module.exports = { 'detect': function (ast, parser) { var result = []; + var hasDoubleSemiColon = function (tree) { + + tree.traverseByType('declarationDelimiter', function (node, index, parent) { + if (parent.content[index + 1].is('declarationDelimiter')) { + result = helpers.addUnique(result, { + 'ruleId': parser.rule.name, + 'severity': parser.severity, + 'line': parent.content[index + 1].start.line, + 'column': parent.content[index + 1].start.column, + 'message': 'No double semicolons allowed' + }); + } + }); + }; + if (ast.syntax !== 'sass') { ast.traverseByType('block', function (block) { var last, @@ -53,6 +68,7 @@ module.exports = { }); } } + hasDoubleSemiColon(parent); } } } diff --git a/tests/rules/trailing-semicolon.js b/tests/rules/trailing-semicolon.js index 34a05efe..48e67476 100644 --- a/tests/rules/trailing-semicolon.js +++ b/tests/rules/trailing-semicolon.js @@ -12,7 +12,7 @@ describe('trailing semicolon - scss', function () { lint.test(file, { 'trailing-semicolon': 1 }, function (data) { - lint.assert.equal(5, data.warningCount); + lint.assert.equal(8, data.warningCount); done(); }); }); @@ -26,7 +26,7 @@ describe('trailing semicolon - scss', function () { } ] }, function (data) { - lint.assert.equal(1, data.warningCount); + lint.assert.equal(4, data.warningCount); done(); }); }); diff --git a/tests/sass/trailing-semicolon.scss b/tests/sass/trailing-semicolon.scss index c92a00fa..c51f9615 100644 --- a/tests/sass/trailing-semicolon.scss +++ b/tests/sass/trailing-semicolon.scss @@ -3,10 +3,11 @@ } .bar { - content: 'qux'; + content: 'qux';; padding: 0 .qux { + float: left;; content: 'waldo' } } @@ -21,7 +22,7 @@ .baz { font: { - family: 'Arial'; + family: 'Arial';; weight: bold; size: 2rem } @@ -30,7 +31,7 @@ .norf { border: { top: { - color: red; + color: red;; left: { radius: 5px