prettier-plugin-svelte icon indicating copy to clipboard operation
prettier-plugin-svelte copied to clipboard

allow comments after style

Open basaran opened this issue 4 years ago • 4 comments

Hello, thank you for this plugin. I have one small issue as it can be seen from the clip below. I like to make my code more beautiful by using comment blocks with nice ascii arts in place.

https://user-images.githubusercontent.com/30809170/138387483-37c30163-8d44-4ab2-80c0-d5b2df268d74.mp4

When I save the file, svelte plugin's reordering mechanism kicks in and shifts Bart footer.

And it also effectively removes any spacing when such shift occurs.

https://user-images.githubusercontent.com/30809170/138387945-dab45a35-3a24-4b43-9cc0-7e23078ec5e2.mp4

It would be better if there was a work around to handle comments blocks.

P.S I'm on sublime.

basaran avatar Oct 22 '21 03:10 basaran

I just noticed that :)

basaran avatar Oct 22 '21 03:10 basaran

I'm transferring this from the ESLint plugin repository to the Prettier plugin repository, because the ESLint plugin doesn't do any reordering like this.

Conduitry avatar Oct 22 '21 03:10 Conduitry

I know, I was about to close but you acted too fast. Thank you.

basaran avatar Oct 22 '21 03:10 basaran

I propose to introduce a new setting for svelteSortOrder called none which would prevent the plugin from reordering anything. This should handle the demands of all people who want more control over what to put where. Adding heuristics what to not reorder in which case sounds like a can of worms to me.

dummdidumm avatar Oct 22 '21 06:10 dummdidumm

With #314 implemented you can chose svelteSortOrder: none which allows you to have comments anywhere you want without them being reordered - closing.

dummdidumm avatar Oct 10 '22 10:10 dummdidumm