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

The new singleAttributePerLine option not working #305

Closed
aradalvand opened this issue Sep 11, 2022 · 4 comments
Closed

The new singleAttributePerLine option not working #305

aradalvand opened this issue Sep 11, 2022 · 4 comments
Labels
enhancement New feature or request

Comments

@aradalvand
Copy link

aradalvand commented Sep 11, 2022

Prettier added a singleAttributePerLine option in version 2.6.0, which applies to any kind of markup including the HTML in .svelte files, but it seems like enabling it has no effect when formatting Svelte files:

Untitled.Project.mp4
@aradalvand aradalvand changed the title The new singleAttributePerLine doesn't work The new singleAttributePerLine option not working Sep 11, 2022
@dummdidumm dummdidumm added the enhancement New feature or request label Sep 11, 2022
@aradalvand
Copy link
Author

aradalvand commented Sep 12, 2022

@dummdidumm Shouldn't this be given the "bug" label as opposed to "enhancement"? Because it's not asking for a new feature, it's just that an already existing option in Prettier isn't functioning.

I'm not familiar with the inner workings of this plugin but doesn't it just pass through the options to Prettier and use its HTML formatter under the hood? If so, then it's kind of strange that this doesn't work already. Am I right?

Thanks.

@dummdidumm
Copy link
Member

It's an enhancement because we don't use the HTML/JSX parser of Prettier which supports this now, we have to create our own. So it's an enhancement because it's a new option which wasn't added support for yet.

@aradalvand
Copy link
Author

we don't use the HTML/JSX parser of Prettier

Don't mean to annoy you but may I ask why? That sounds like a strange design decision.

@dummdidumm
Copy link
Member

Because the HTML parser would parse things like {#if ... or {foo} as a regular string, and get confused at things like <div on:click={() => ..}

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

No branches or pull requests

2 participants