Skip to content

Commit

Permalink
fixes #199. false positive spaceBeforeBrace on @import
Browse files Browse the repository at this point in the history
  • Loading branch information
fiftyfactorauthentication committed Jul 11, 2016
1 parent 3f2759d commit a5e799e
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/linters/space_before_brace.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ module.exports = {
throw new Error('Invalid setting value for spaceBeforeBrace: ' + config.style);
}

if (node.ruleWithoutBody) {
// if the node is a bodiless rule, or it's an import statement, bail.
if (node.ruleWithoutBody || node.name === 'import') {
return;
}

Expand Down
13 changes: 13 additions & 0 deletions test/specs/linters/space_before_brace.js
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,19 @@ describe('lesshint', function () {
});
});

it('should not check imports', function () {
var source = '@import \'lib/colors\';';
var options = {
style: 'one_space'
};

return spec.parse(source, function (ast) {
var result = spec.linter.lint(options, ast.root.first);

expect(result).to.be.undefined;
});
});

it('should ignore nodes without a following block', function () {
var source = '.foo();';
var options = {
Expand Down
10 changes: 10 additions & 0 deletions test/specs/linters/trailing_semicolon.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,5 +87,15 @@ describe('lesshint', function () {
expect(result).to.be.undefined;
});
});

it('should not check imports', function () {
var source = '@import \'lib/colors\';';

return spec.parse(source, function (ast) {
var result = spec.linter.lint({}, ast.root.first);

expect(result).to.be.undefined;
});
});
});
});

0 comments on commit a5e799e

Please sign in to comment.