From eaffab98eba330ed343df6edd4a2b3113c1888ea Mon Sep 17 00:00:00 2001 From: Andrew Campbell Date: Thu, 12 May 2022 11:33:31 +0000 Subject: [PATCH] Add support for empty lines inside jsdoc comment blocks --- index.js | 2 +- test.js | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index f60c02d..25b6dc9 100644 --- a/index.js +++ b/index.js @@ -46,7 +46,7 @@ function normalizeComment(comment /*: Comment */) /*: string */ { trimmed.forEach((line, index) => { let offset = index === 0 && start === 0 ? startPos : 0; let match = line.match(SPACE_UNTIL_CONTENT); - if (match) { + if (match && !EMPTY_LINE.test(line)) { indents.push(offset + match[0].length); } }); diff --git a/test.js b/test.js index 3dddada..f01d2d8 100644 --- a/test.js +++ b/test.js @@ -95,11 +95,13 @@ cases('normalizeComments()', opts => { code: ` /** * comment + * * comment */ `, output: ` comment + comment `, },