forked from sveltejs/prettier-plugin-svelte
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(fix) destructuring with default values
- use expandNode for each context - support array and object expressions in expandNode sveltejs#265
- Loading branch information
Simon Holthausen
committed
Dec 3, 2021
1 parent
3ea98f0
commit 29c7c8b
Showing
4 changed files
with
43 additions
and
5 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
16 changes: 16 additions & 0 deletions
16
test/formatting/samples/each-await-block-destructuring/input.html
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 @@ | ||
{#each arr as { a,b =''}} | ||
{a} | ||
{b} | ||
{/each} | ||
|
||
{#await promise then { a,b =''}} | ||
{a} | ||
{b} | ||
{/await} | ||
|
||
{#await promise} | ||
Loading | ||
{:then { a,b =''}} | ||
{a} | ||
{b} | ||
{/await} |
16 changes: 16 additions & 0 deletions
16
test/formatting/samples/each-await-block-destructuring/output.html
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 @@ | ||
{#each arr as { a, b = '' }} | ||
{a} | ||
{b} | ||
{/each} | ||
|
||
{#await promise then { a, b = '' }} | ||
{a} | ||
{b} | ||
{/await} | ||
|
||
{#await promise} | ||
Loading | ||
{:then { a, b = '' }} | ||
{a} | ||
{b} | ||
{/await} |
2 changes: 1 addition & 1 deletion
2
test/printer/samples/each-block-destructured-default-value.html
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
{#each animals as {key, value = []}} | ||
{#each animals as { key, value = 1, arrayExpr = [{ a: true }], objectExpr = { a: true, b: [1] } }} | ||
<p>{key}: {value}</p> | ||
{/each} |