Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix removing commas from function arguments in maps (#14089)
Co-authored-by: fisker Cheung <lionkay@gmail.com>
- Loading branch information
1 parent
b77d912
commit 0c5d4f3
Showing
5 changed files
with
106 additions
and
31 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,22 @@ | ||
#### Fix removing commas from function arguments in maps (#14089 by @sosukesuzuki) | ||
|
||
<!-- prettier-ignore --> | ||
```scss | ||
/* Input */ | ||
$foo: map-fn( | ||
( | ||
"#{prop}": inner-fn($first, $second), | ||
) | ||
); | ||
|
||
/* Prettier stable */ | ||
$foo: map-fn(("#{prop}": inner-fn($first $second))); | ||
|
||
/* Prettier main */ | ||
$foo: map-fn( | ||
( | ||
"#{prop}": inner-fn($first, $second), | ||
) | ||
); | ||
|
||
``` |
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
51 changes: 51 additions & 0 deletions
51
tests/format/scss/map/function-argument/__snapshots__/jsfmt.spec.js.snap
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
18 changes: 18 additions & 0 deletions
18
tests/format/scss/map/function-argument/function-argument-2.scss
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 @@ | ||
$display-breakpoints: map-deep-merge( | ||
( | ||
"sm-only": "only screen and (min-width: #{$map-get + $grid-breakpoints + "hogehoge"}) and (max-width: #{$a})", | ||
"sm-only": "inside a long long long long long long long long long long long long long long string #{call("")}", | ||
"sm-only": "inside a long long long long long long long long long long long long long long string #{$foo} and #{call("")}", | ||
"sm-only": "inside a long long long long long long long long long long long long long long string #{call($a)}", | ||
), | ||
$display-breakpoints | ||
); | ||
|
||
@each $name, $hue in $hues { | ||
$map: map.merge( | ||
$map, | ||
( | ||
'#{$prefix}-#{$name}': blend.set($base, $hue: $hue), | ||
) | ||
); | ||
} |