Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Never put spaces to the right of stars in indentable block comments #5330

Merged
merged 2 commits into from Nov 3, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/language-js/printer-estree.js
Expand Up @@ -6165,8 +6165,9 @@ function printIndentableBlockComment(comment) {
hardline,
lines.map(
(line, index) =>
(index === 0 && line[0] === "*" ? "" : " ") +
(index < lines.length - 1 ? line.trim() : line.trimLeft())
index === 0
? line.trimRight()
: " " + (index < lines.length - 1 ? line.trim() : line.trimLeft())
)
),
"*/"
Expand Down
26 changes: 26 additions & 0 deletions tests/comments/__snapshots__/jsfmt.spec.js.snap
Expand Up @@ -1735,6 +1735,19 @@ if(true) {
/* first line
* second line
* third line */

/*! first line
*second line
* third line */

/*!
* Extracted from vue codebase
* https://github.com/vuejs/vue/blob/cfd73c2386623341fdbb3ac636c4baf84ea89c2c/src/compiler/parser/html-parser.js
* HTML Parser By John Resig (ejohn.org)
* Modified by Juriy "kangax" Zaytsev
* Original code by Erik Arvidsson, Mozilla Public License
* http://erik.eae.net/simplehtmlparser/simplehtmlparser.js
*/
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/*
* Looking good!
Expand All @@ -1754,6 +1767,19 @@ if (true) {
* second line
* third line */

/*! first line
*second line
* third line */

/*!
* Extracted from vue codebase
* https://github.com/vuejs/vue/blob/cfd73c2386623341fdbb3ac636c4baf84ea89c2c/src/compiler/parser/html-parser.js
* HTML Parser By John Resig (ejohn.org)
* Modified by Juriy "kangax" Zaytsev
* Original code by Erik Arvidsson, Mozilla Public License
* http://erik.eae.net/simplehtmlparser/simplehtmlparser.js
*/

`;

exports[`switch.js - flow-verify 1`] = `
Expand Down
13 changes: 13 additions & 0 deletions tests/comments/single-star-jsdoc.js
Expand Up @@ -15,3 +15,16 @@ if(true) {
/* first line
* second line
* third line */

/*! first line
*second line
* third line */

/*!
* Extracted from vue codebase
* https://github.com/vuejs/vue/blob/cfd73c2386623341fdbb3ac636c4baf84ea89c2c/src/compiler/parser/html-parser.js
* HTML Parser By John Resig (ejohn.org)
* Modified by Juriy "kangax" Zaytsev
* Original code by Erik Arvidsson, Mozilla Public License
* http://erik.eae.net/simplehtmlparser/simplehtmlparser.js
*/