Merge pull request #262 from josh/comment-before-newlines

Fix whitespace before comments
This commit is contained in:
Sebastian McKenzie 2014-12-07 21:11:48 +11:00
commit 24f6dfa8e2
5 changed files with 35 additions and 1 deletions

View File

@ -68,7 +68,6 @@ Buffer.prototype.removeLast = function (cha) {
Buffer.prototype.newline = function (i, removeLast) {
if (!this.buf) return;
if (this.format.compact) return;
if (this.endsWith("{\n")) return;
if (_.isBoolean(i)) {
removeLast = i;
@ -76,6 +75,7 @@ Buffer.prototype.newline = function (i, removeLast) {
}
if (_.isNumber(i)) {
if (this.endsWith("{\n")) i--;
if (this.endsWith(util.repeat(i, "\n"))) return;
var self = this;

View File

@ -0,0 +1,10 @@
function test() {
/*
* this is comment
*/
var i = 20;
}

View File

@ -0,0 +1,10 @@
function test() {
/*
* this is comment
*/
var i = 20;
}

View File

@ -0,0 +1,7 @@
// from #23
/**/
/*
*/

View File

@ -0,0 +1,7 @@
// from #23
/**/
/*
*/