Ignore whitespace in docblock right after /** (#3430)
parent
7cff189dd8
commit
90e8b13e86
2
index.js
2
index.js
|
@ -82,7 +82,7 @@ function formatWithCursor(text, opts, addAlignmentSize) {
|
||||||
const pragmas = Object.assign({ format: "" }, parsedDocblock.pragmas);
|
const pragmas = Object.assign({ format: "" }, parsedDocblock.pragmas);
|
||||||
const newDocblock = docblock.print({
|
const newDocblock = docblock.print({
|
||||||
pragmas,
|
pragmas,
|
||||||
comments: parsedDocblock.comments.replace(/^(\r?\n)+/, "") // remove leading newlines
|
comments: parsedDocblock.comments.replace(/^(\s+?\r?\n)+/, "") // remove leading newlines
|
||||||
});
|
});
|
||||||
const strippedText = docblock.strip(text);
|
const strippedText = docblock.strip(text);
|
||||||
const separatingNewlines = strippedText.startsWith("\n") ? "\n" : "\n\n";
|
const separatingNewlines = strippedText.startsWith("\n") ? "\n" : "\n\n";
|
||||||
|
|
|
@ -85,3 +85,24 @@ function foo(bar) {
|
||||||
}
|
}
|
||||||
|
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
exports[`trailing-spaces-first-line.js 1`] = `
|
||||||
|
/**
|
||||||
|
* Copyright (c) 2015-present, Facebook, Inc.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This source code is licensed under the license found in the LICENSE file in
|
||||||
|
* the root directory of this source tree.
|
||||||
|
*/
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
/**
|
||||||
|
* Copyright (c) 2015-present, Facebook, Inc.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This source code is licensed under the license found in the LICENSE file in
|
||||||
|
* the root directory of this source tree.
|
||||||
|
*
|
||||||
|
* @format
|
||||||
|
*/
|
||||||
|
|
||||||
|
`;
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
/**
|
||||||
|
* Copyright (c) 2015-present, Facebook, Inc.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This source code is licensed under the license found in the LICENSE file in
|
||||||
|
* the root directory of this source tree.
|
||||||
|
*/
|
Loading…
Reference in New Issue