fix(less): remove CRs from inline comments (#5334)

The issue here is that less parser somehow included CRs in `comment.raws.content`, but it was hidden by the wrong trailing space elimination previously, which was fixed by #5165.

We already have such tests but it's not reproducible in AppVeyor since they use LF ([`core.autocrlf=input`](https://stackoverflow.com/a/20653073)).
master
Ika 2018-11-04 11:36:14 +08:00 committed by GitHub
parent 275b0543c8
commit 0878a6a3e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -110,7 +110,11 @@ function genericPrint(path, options, print) {
}
case "css-comment": {
if (node.raws.content) {
return node.raws.content;
return (
node.raws.content
// there's a bug in the less parser that trailing `\r`s are included in inline comments
.replace(/^(\/\/[^]+)\r+$/, "$1")
);
}
const text = options.originalText.slice(
options.locStart(node),