Handling of multiple HTML comments on top of file
Scenario: I try to write to comments on the top of the svelte file.
Expected behavior: They are preserved.
Actual behavior: prettier-plugin-svelte seems to push one off and places it before the template part:
diff --git a/ts/editor/image-overlay/WithImageConstrained.svelte b/ts/editor/image-overlay/WithImageConstrained.svelte
index 50abe8bdf..13e8e2a40 100644
--- a/ts/editor/image-overlay/WithImageConstrained.svelte
+++ b/ts/editor/image-overlay/WithImageConstrained.svelte
@@ -1,8 +1,4 @@
<!--
-Copyright: ...
-License: ...
--->
-<!--
@component
My comp
-->
@@ -202,6 +198,12 @@ My comp
}
</script>
+<!--
+Copyright: ...
+License: ...
+-->
+
+
{#if activeImage}
<slot {toggleActualSize} {active} />
{/if}
Related (?): #258
I just ran into this last week, actually. I ended up just combining the comments into a single comment so that it would stay at the top of the file.
However I noticed that it will then show the copyright + license in the tooltip for the component.
There's now a none option for the sort order which will not reorder anything. As for the bug: The best solution would probably to only change the current logic to "keep all comments except <!-- prettier-ignore -->" where they are when reordering.