Skip to content

Commit

Permalink
Fixed an extra new-line before a single-line comment
Browse files Browse the repository at this point in the history
  • Loading branch information
Anantachai Saothong (Manta) committed May 8, 2017
1 parent a9dd2cc commit 280dbf6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
4 changes: 4 additions & 0 deletions edge/format.js
Original file line number Diff line number Diff line change
Expand Up @@ -964,6 +964,10 @@ function format(content, options = {}) {
}
}

if (commentNodes.length > 0) {
commentNodes[0].insertNewLineAbove = false
}

return commentNodes
}

Expand Down
7 changes: 6 additions & 1 deletion spec/comment-single-line/input.styl
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,22 @@
//comment-7
//comment-8



//comment-9


//comment-10
//comment-11
.class2
display block
var='http://example.com'//comment-11


//comment-12
.class3
position static
display none
//comment-12
//comment-13
.class4
display block
3 changes: 2 additions & 1 deletion spec/comment-single-line/output.styl
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,13 @@
}
}

// comment-12
.class3 {
display: none;
position: static;
}

// comment-12
// comment-13
.class4 {
display: block;
}

0 comments on commit 280dbf6

Please sign in to comment.