Last active
August 17, 2019 08:20
-
-
Save garybernhardt/55254ce390b87b2121cee69f1c2f61f6 to your computer and use it in GitHub Desktop.
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
function f() { | |
switch (x) { | |
case "1": | |
<div>foo</div> | |
case "2": | |
return <div> | |
<div> | |
foo | |
</div> | |
<div>foo</div> | |
</div> | |
case "3": | |
return <div> | |
<div>foo</div> | |
<div /> | |
</div> | |
case "4": | |
return <div> | |
foo | |
</div> | |
} | |
} |
This is what Yats does (when you add the parentheses), it seems Yats uses standard xml.vim to indent JSX, thus it works fine when JSX begins with a new line.
function f() {
switch (x) {
case "1":
<div>foo</div>
case "2":
return (
<div>
<div>
foo
</div>
<div>foo</div>
</div>
)
case "3":
return (
<div>
<div>foo</div>
<div/>
</div>
)
case "4":
return (
<div>
foo
</div>
)
}
}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Prettier formats like so (after fixing typo)