Skip to content

Commit

Permalink
Fix 2.2.0 newlineAfterBlock regression. Closes #274
Browse files Browse the repository at this point in the history
  • Loading branch information
jwilsson committed Oct 28, 2016
1 parent 1af1213 commit 199e125
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/linters/newline_after_block.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module.exports = {
message: 'All blocks should be followed by a new line.',

lint: function newlineAfterBlockLinter (config, node) {
var regexp = /\n[ \t]*\n?/;
var regexp = /\n[ \t]*\n/;
var parent = node.parent;
var prev;

Expand Down
20 changes: 19 additions & 1 deletion test/specs/linters/newline_after_block.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,25 @@ describe('lesshint', function () {
});
});

it('should not allow adjacent blocks without a new line', function () {
it('should not allow adjacent blocks without a blank line', function () {
var source = [
'.foo { color: red; }',
'.bar { color: blue; }'
];
var expected = [{
message: 'All blocks should be followed by a new line.'
}];

source = source.join('\n');

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

expect(result).to.deep.equal(expected);
});
});

it('should not allow adjacent blocks on the same line', function () {
var source = [
'.foo { color: red; }',
'.bar { color: blue; }'
Expand Down

0 comments on commit 199e125

Please sign in to comment.