sveltejs / prettier-plugin-svelte

Format your svelte components using prettier.
MIT License
714 stars 95 forks source link

svelteSortOrder none causes style and script tags to be removed when they are at the end of the file #406

Open acls opened 8 months ago

acls commented 8 months ago

With the option svelteSortOrder: 'none', in my .prettierrc.js file, the script and style tags are removed when they are the last element in the file.

This file:

<div></div>
<style></style>
<script></script>

will be formatted to:

<div></div>
<style></style>

and formatting it again it will become:

<div></div>

But those tags won't be removed when the markup is at the end, so when this file is formatted it stays the same:

<style></style>
<script></script>
<div></div>
KostisFioravantes commented 6 months ago

The same bug here. I think that preventing a formatter from completely removing source code should be a priority. Honestly svelteSortOrder none is useless as long as this bug stays unfixed.