Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFC: <template> in CallExpression argument position #192

Closed
gitKrystan opened this issue Dec 6, 2023 · 3 comments · Fixed by #194
Closed

RFC: <template> in CallExpression argument position #192

gitKrystan opened this issue Dec 6, 2023 · 3 comments · Fixed by #194

Comments

@gitKrystan
Copy link
Collaborator

Vote by reacting to this issue. Comment with more details below. Do you prefer:

Option A (🚀)

This is what v2.0.0-0 is currently returning.

await render(
  <template>
    <h1>I am a multi-line template</h1>
    <p>With some text</p>
  </template>,
);

Option B (👎)

This is what v1 currently returns.

await render(<template>
  <h1>I am a multi-line template</h1>
  <p>With some text</p>
</template>);
@gitKrystan gitKrystan changed the title RFC: <template> in CallExpression argument position RFC: <template> in CallExpression argument position Dec 6, 2023
@NullVoxPopuli
Copy link
Member

I always format my own stuff as the option a anyway. I think it looks better

@IgnaceMaes
Copy link

IgnaceMaes commented Dec 6, 2023

Is that trailing comma in option A intentional?

I personally also format my tests as described in option A. One downside is that it has an extra level of indentation over option B. But considering test templates usually are quite flat, it's not really an issue.

@gitKrystan
Copy link
Collaborator Author

gitKrystan commented Dec 6, 2023

Is that trailing comma in option A intentional?

Yes, it comes from prettier's default trailing comma config. You can change the config (setting it to 'es5' should do it) but it would affect all your JS, not just the JS with <template> arguments. I kinda hate the comma too since we know render only takes one argument, but I'm not sure of a good way to remove it. Maybe special-casing render.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants