-
Notifications
You must be signed in to change notification settings - Fork 13
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
23 changed files
with
471 additions
and
415 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
87 changes: 14 additions & 73 deletions
87
packages/babel-plugin-alloy/test/fixtures/blank-lines/code.js
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,84 +1,25 @@ | ||
/* | ||
After normal transform: | ||
* Group sequences of lines which are conditional | ||
* If literal text comes after the group, consume group plus trailing linebreak. | ||
Join by line break. Render trailing linebreak if anything in group is present. | ||
* If group is before end of component/fragment, consume leading linebreak plus | ||
group. Join by line break. Render leading linebreak if anything in group is | ||
present. | ||
*/ | ||
function blankLines() { | ||
return <Hi> | ||
|
||
/* | ||
function Foo() { | ||
return <A> | ||
{a} | ||
{b} | ||
c | ||
</A> | ||
} | ||
function Foo() { | ||
return <A>{maybeLine(a)}{maybeLine(b)}c</A> | ||
} | ||
function Bar() { | ||
return <A> | ||
{a}x | ||
{b} | ||
c | ||
</A> | ||
} | ||
function Bar() { | ||
return <A>{a}x{maybeLine(() => b)}c</A> | ||
} | ||
hello | ||
|
||
function Baz() { | ||
return <A> | ||
{a}x | ||
{b} | ||
</A> | ||
} | ||
function Baz() { | ||
return <A>{a}x | ||
{b}</A> | ||
} | ||
function Baz() { | ||
return <A>{a}x{maybeLastLine(() => b)}</A> | ||
} | ||
how | ||
|
||
maybeLines -> lines.join("\n"); | ||
maybeLastLines -> "\n" + lines.join("\n"); | ||
|
||
function Baz2() { | ||
return <A> | ||
{a} | ||
{b} | ||
{c} | ||
</A> | ||
are you | ||
</Hi>; | ||
} | ||
|
||
function Baz2() { | ||
return <A>{maybeLine(a)}{maybeLine(b)}{maybeLastLine(c)}</A> | ||
} | ||
function blankLinesWithIndent() { | ||
return <Hi> | ||
|
||
maybeLine -> x + "\n"; | ||
maybeLastLine -> x; | ||
hello | ||
|
||
const maybeLines = <>{a} | ||
{b} | ||
{c}</> | ||
how | ||
|
||
const maybeLastLines = <>start | ||
{a} | ||
{b} | ||
{c}</> | ||
|
||
const bothLines = <>{a} | ||
start | ||
{a} | ||
middle | ||
{a}</> | ||
are you | ||
|
||
const bothLines = <>{maybeStart(a)}start | ||
{maybeStart(a)}middle{maybeEnd(a)}</> | ||
*/ | ||
there | ||
</Hi>; | ||
} |
Oops, something went wrong.