Conversation
|
This PR requires additional improvements:
|
21957c0 to
f8cb14c
Compare
|
@sergeche Hey! I didn't see a CONTRIBUTING.md guide (I could help create one if needed) so I created this branch and marked it as WIP to show that some work is in progress. Its defineitely not ready yet. Thanks for the comments! I'll expand the test coverage to cover all possible cases for sure. I'm still in the process of understanding what's going on here in general. For now, I've created a separate I've already added the support for Quick question: since |
| commentNodeAfter(node, state); | ||
| } | ||
| } else if (config.options['jsx.enabled'] && !node.name) { | ||
| // Handle JSX fragment |
There was a problem hiding this comment.
That defineitely should be tweaked, but Im not sure yet if its a valid way to handle jsx fragment in general
There was a problem hiding this comment.
No, nodes without name could be a (group), e.g. (ul>.item*4)+footer
| const config: UserConfig = { options: { "jsx.enabled": true } }; | ||
|
|
||
| it("should expand fragment", () => { | ||
| // should it work without explicit jsx.enabled ? It's not a valid html tag afaik |
There was a problem hiding this comment.
Here is the question i had. Should the result actually be expanded to <></> ?
There was a problem hiding this comment.
I think it’s OK to expand to <>\n\t${0}\n</> since its use case is to insert multiple nodes which will be formatted anyways
| // should it work without explicit jsx.enabled ? It's not a valid html tag afaik | ||
| equal(expand("frag"), "<></>"); | ||
| // invalid result, adds one more fragment | ||
| equal(expand("frag", config), "<></>"); |
There was a problem hiding this comment.
TODO: actual result is invalid (<><></></>)
| // invalid result, adds one more fragment at start | ||
| equal( | ||
| expand("frag>ul>li*4", config), | ||
| "<><ul>\n\t<li></li>\n\t<li></li>\n\t<li></li>\n\t<li></li>\n</ul></>" |
There was a problem hiding this comment.
TODO: actual result is invalid (<><></><ul>\n\t<li></li>\n\t<li></li>\n\t<li></li>\n\t<li></li>\n</ul></>)
fixes #735
🚧 This PR is not ready yet
Resolves to React.Fragment shorthand <></>