Skip to content

Commit

Permalink
Fix line-between broking when file start with comment
Browse files Browse the repository at this point in the history
Issue 525
  • Loading branch information
mariovalney authored and jdalton committed Apr 18, 2019
1 parent 38cd55e commit d7f40ee
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/options/lines-between-rulesets.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,10 @@ let option = {
if (this.prevLineIsComment(node, index) || this.isComment(prevChild)) {
let lastNonCommentIndex = this.findLatestNonCommentNode(node, index);
prevChild = node.get(lastNonCommentIndex);

if (!prevChild) {
return;
}
}

if (prevChild.is('space')) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/*comment*/
.foo {background: red;}


Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/*comment*/
.foo {background: red;}/*comment*/.bar{border: 1px solid red;}.baz{color: #fff;}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/*comment*/
.foo {background: red;}

/*comment*/.bar{border: 1px solid red;}
Expand Down

0 comments on commit d7f40ee

Please sign in to comment.