-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: format JSX expressions with 3+ roots (#392)
* fix: format JSX expressions with 3+ roots * chore: changeset
- Loading branch information
1 parent
bc62d2f
commit b4b0918
Showing
5 changed files
with
126 additions
and
0 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,5 @@ | ||
--- | ||
'prettier-plugin-astro': patch | ||
--- | ||
|
||
Fix not being able to format expressions with more than 2 roots |
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
27 changes: 27 additions & 0 deletions
27
test/fixtures/other/expression-multiple-roots-stress/input.astro
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,27 @@ | ||
{ | ||
Promise.all([ | ||
[].map((something) => { | ||
return [ | ||
<div></div>, | ||
<div></div>, | ||
<div></div>, | ||
<div></div> | ||
] | ||
}), | ||
[].map((something) => { | ||
return <div></div><div></div><div></div><div></div> | ||
}), | ||
[].map((something) => { | ||
return <div></div><div></div><div></div><div></div> + <div></div><div></div><div></div><div></div> | ||
}), | ||
[].map((something) => { | ||
return <div></div><div></div><div></div><div></div> + {something: <div></div><div></div><div></div><div></div>} | ||
}), | ||
|
||
<div></div><div></div><div></div><div></div> | ||
]) | ||
} | ||
|
||
{ | ||
<div></div><div></div><div></div> | ||
} |
76 changes: 76 additions & 0 deletions
76
test/fixtures/other/expression-multiple-roots-stress/output.astro
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,76 @@ | ||
{ | ||
Promise.all([ | ||
[].map((something) => { | ||
return [<div />, <div />, <div />, <div />]; | ||
}), | ||
[].map((something) => { | ||
return ( | ||
<> | ||
<div /> | ||
<div /> | ||
<div /> | ||
<div /> | ||
</> | ||
); | ||
}), | ||
[].map((something) => { | ||
return ( | ||
( | ||
<> | ||
<div /> | ||
<div /> | ||
<div /> | ||
<div /> | ||
</> | ||
) + | ||
( | ||
<> | ||
<div /> | ||
<div /> | ||
<div /> | ||
<div /> | ||
</> | ||
) | ||
); | ||
}), | ||
[].map((something) => { | ||
return ( | ||
( | ||
<> | ||
<div /> | ||
<div /> | ||
<div /> | ||
<div /> | ||
</> | ||
) + | ||
{ | ||
something: ( | ||
<> | ||
<div /> | ||
<div /> | ||
<div /> | ||
<div /> | ||
</> | ||
), | ||
} | ||
); | ||
}), | ||
|
||
<> | ||
<div /> | ||
<div /> | ||
<div /> | ||
<div /> | ||
</>, | ||
]) | ||
} | ||
|
||
{ | ||
( | ||
<> | ||
<div /> | ||
<div /> | ||
<div /> | ||
</> | ||
) | ||
} |
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