-
-
Notifications
You must be signed in to change notification settings - Fork 336
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
106 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
diff --git a/src/language-css/printer-postcss.js b/src/language-css/printer-postcss.js | ||
index 4ba444c8d..eaa5e38ff 100644 | ||
--- a/src/language-css/printer-postcss.js | ||
+++ b/src/language-css/printer-postcss.js | ||
@@ -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, |
23 changes: 23 additions & 0 deletions
23
.github/fix-prettier-14008-no-space-after-unary-minus.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
diff --git a/src/language-css/printer-postcss.js b/src/language-css/printer-postcss.js | ||
index 4ba444c8d..a15f7981f 100644 | ||
--- a/src/language-css/printer-postcss.js | ||
+++ b/src/language-css/printer-postcss.js | ||
@@ -744,6 +744,18 @@ function genericPrint(path, options, print) { | ||
continue; | ||
} | ||
|
||
+ // No space before unary minus followed by an opening parenthesis `-(` | ||
+ if ( | ||
+ (options.parser === "scss" || options.parser === "less") && | ||
+ isMathOperator && | ||
+ iNode.value === "-" && | ||
+ isParenGroupNode(iNextNode) && | ||
+ locEnd(iNode) === locStart(iNextNode.open) && | ||
+ iNextNode.open.value === "(" | ||
+ ) { | ||
+ continue; | ||
+ } | ||
+ | ||
// Add `hardline` after inline comment (i.e. `// comment\n foo: bar;`) | ||
if (isInlineValueCommentNode(iNode)) { | ||
if (parentNode.type === "value-paren_group") { |
18 changes: 18 additions & 0 deletions
18
.github/fix-prettier-14034-no-property-name-lower-if-inside-variable-declaration.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
diff --git a/src/language-css/printer-postcss.js b/src/language-css/printer-postcss.js | ||
index 4ba444c8d..431cdc7a6 100644 | ||
--- a/src/language-css/printer-postcss.js | ||
+++ b/src/language-css/printer-postcss.js | ||
@@ -155,7 +155,12 @@ function genericPrint(path, options, print) { | ||
|
||
return [ | ||
node.raws.before.replace(/[\s;]/g, ""), | ||
- insideICSSRuleNode(path) ? node.prop : maybeToLowerCase(node.prop), | ||
+ (parentNode.type === "css-atrule" && | ||
+ typeof parentNode.raws.params === "string" && | ||
+ parentNode.raws.params.startsWith(":")) || | ||
+ insideICSSRuleNode(path) | ||
+ ? node.prop | ||
+ : maybeToLowerCase(node.prop), | ||
trimmedBetween.startsWith("//") ? " " : "", | ||
trimmedBetween, | ||
node.extend ? "" : " ", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
diff --git a/src/language-css/printer-postcss.js b/src/language-css/printer-postcss.js | ||
index 4ba444c8d..4f7738bfa 100644 | ||
--- a/src/language-css/printer-postcss.js | ||
+++ b/src/language-css/printer-postcss.js | ||
@@ -886,11 +886,11 @@ function genericPrint(path, options, print) { | ||
|
||
if (!node.open) { | ||
const printed = path.map(print, "groups"); | ||
- const res = []; | ||
+ const res = [hardline]; | ||
|
||
for (let i = 0; i < printed.length; i++) { | ||
if (i !== 0) { | ||
- res.push([",", line]); | ||
+ res.push([",", hardline]); | ||
} | ||
res.push(printed[i]); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
module.exports = { | ||
tabWidth: 4, | ||
printWidth: 120, | ||
overrides: [ | ||
{ | ||
files: ['*.less', '*.overrides', '*.variables'], | ||
options: { | ||
parser: 'less', | ||
}, | ||
}, | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters