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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃悰 BUG: Attributes names are removed #114

Closed
altano opened this issue Jan 22, 2022 · 4 comments 路 Fixed by #222
Closed

馃悰 BUG: Attributes names are removed #114

altano opened this issue Jan 22, 2022 · 4 comments 路 Fixed by #222

Comments

@altano
Copy link

altano commented Jan 22, 2022

Describe the Bug

Attribute names are removed from component usage in .astro files:

Original code:

<BaseHead title={title} description={description} permalink={permalink} />

Formatted to:

<BaseHead {title} {description} {permalink} />

Expected:

<BaseHead title={title} description={description} permalink={permalink} />

This shorter syntax seems to work but there are two problems with it:

  1. It isn't documented
  2. It doesn't work with TypeScript
    image

Steps to Reproduce

See code formatting examples above

@briannicholas
Copy link

add this to your .prettierrc file

"astroAllowShorthand": false

@altano
Copy link
Author

altano commented Feb 18, 2022

Works for me, thanks!

Give that the shorthand syntax is undocumented and doesn't (can't?) work with TypeScript props, and TypeScript is baked into Astro such that you don't opt-in to it, should longhand props be the default?

@jasikpark
Copy link
Collaborator

In https://github.com/withastro/prettier-plugin-astro/releases/tag/v0.1.0-next.3 astroAllowShorthand is defaulted to false, so hopefully in v0.1.0 that'll be the case

@antonyfaris
Copy link
Member

In https://github.com/withastro/prettier-plugin-astro/releases/tag/v0.1.0-next.3 astroAllowShorthand is defaulted to false, so hopefully in v0.1.0 that'll be the case

Yes, that will be the case. See #143

@Princesseuh Princesseuh linked a pull request Jun 24, 2022 that will close this issue
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.

4 participants