Never put spaces to the right of stars in indentable block comments (#5330)
Fixes #5323. Previously we added space after `/*` _on the first line only,_ but the intent is to only fix the indentation of comments, not changing their "contents". Besides, this was inconsistent with the handling of every following line. Finally, it broke `/*!` comments which some minifiers look for to know which (license) comments to keep. People can use https://eslint.org/docs/rules/spaced-comment to enforce when to start comments with spaces.master
parent
f6d8be881c
commit
275b0543c8
|
@ -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())
|
||||
)
|
||||
),
|
||||
"*/"
|
||||
|
|
|
@ -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!
|
||||
|
@ -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`] = `
|
||||
|
|
|
@ -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
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue