Fix semicolon duplicated at the end of LESS file (#14007)

Fix semicolon duplicated at the end of file
This commit is contained in:
Michael Voříšek authored and GitHub committed 2022-12-30 17:09:55 +09:00
1 parent 369bf2a1c1
commit efa6aa68b6
4 files changed
+44 -1

No files matched your search

+19
View File
@@ -0,0 +1,19 @@
#### Fix semicolon duplicated at the end of LESS file (#14007 by @mvorisek)
<!-- prettier-ignore -->
```less
// Input
@variable: {
field: something;
};
// Prettier stable
@variable: {
field: something;
}; ;
// Prettier main
@variable: {
field: something;
};
```
+4 -1
View File
@@ -101,7 +101,10 @@ function genericPrint(path, options, print) {
return [node.raw, hardline];
case "css-root": {
const nodes = printNodeSequence(path, options, print);
const after = node.raws.after.trim();
let after = node.raws.after.trim();
if (after.startsWith(";")) {
after = after.slice(1).trim();
}
return [
nodes,
@@ -83,6 +83,24 @@ a: b;
================================================================================
`;
exports[`issue-11483--never-append-anything.less format 1`] = `
====================================options=====================================
parsers: ["less"]
printWidth: 80
| printWidth
=====================================input======================================
@variable: {
field: something;
};
=====================================output=====================================
@variable: {
field: something;
};
================================================================================
`;
exports[`less.less format 1`] = `
====================================options=====================================
parsers: ["less"]
@@ -0,0 +1,3 @@
@variable: {
field: something;
};