Fix printing of SCSS selector() function (#12213)
This commit is contained in:
1 parent
e22c4911f8
commit
543aa9abf1
4 files changed
+25
-2
No files matched your search
@@ -0,0 +1,16 @@
|
||||
#### Fixes printing parameters of a mixin named `selector()` (#12213 by @duailibe)
|
||||
|
||||
<!-- prettier-ignore -->
|
||||
```css
|
||||
/* Input */
|
||||
@mixin selector($param: 'value') {
|
||||
}
|
||||
|
||||
/* Prettier stable */
|
||||
@mixin selector($param: 'value) {
|
||||
}
|
||||
|
||||
/* Prettier main */
|
||||
@mixin selector($param: 'value') {
|
||||
}
|
||||
```
|
||||
@@ -493,8 +493,8 @@ function genericPrint(path, options, print) {
|
||||
grandParent.type === "value-func" &&
|
||||
grandParent.value === "selector"
|
||||
) {
|
||||
const start = locStart(parentNode.open) + 1;
|
||||
const end = locEnd(parentNode.close) - 1;
|
||||
const start = locEnd(parentNode.open) + 1;
|
||||
const end = locStart(parentNode.close);
|
||||
const selector = options.originalText.slice(start, end).trim();
|
||||
|
||||
return lastLineHasInlineComment(selector)
|
||||
|
||||
@@ -3482,6 +3482,8 @@ $background
|
||||
@mixin button-variant($foo: " ... ") {}
|
||||
@mixin sexy-border($color, $width, $foo: (color: red)) {}
|
||||
|
||||
@mixin selector($param: "value") {}
|
||||
|
||||
=====================================output=====================================
|
||||
@mixin clearfix {
|
||||
}
|
||||
@@ -3551,6 +3553,9 @@ $background
|
||||
@mixin sexy-border($color, $width, $foo: (color: red)) {
|
||||
}
|
||||
|
||||
@mixin selector($param: "value") {
|
||||
}
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
|
||||
@@ -105,3 +105,5 @@ $background
|
||||
@mixin button-variant($foo: " ... ") {}
|
||||
@mixin button-variant($foo: " ... ") {}
|
||||
@mixin sexy-border($color, $width, $foo: (color: red)) {}
|
||||
|
||||
@mixin selector($param: "value") {}
|
||||
Reference in new issue
Block a user