Prettier and Svelte issues

2020 11 06

I've been finding a lot of late that my svelteSortOrder settings have been getting knocked out of place. I know it's only a small thing but I cant stand when styles are between the script tag and HTML.

I've been changing my settings in my VSCode settings.json like this:

"editor.defaultFormatter": "esbenp.prettier-vscode",

"[svelte]": { "editor.defaultFormatter": "svelte.svelte-vscode" }

In the root of any folder, this .prettierrc

{ "svelteSortOrder": "scripts-markup-styles" }

Thanks to the @sveltejs discord. I've figured out the "turn it off and on again" solution for this issues that is.

  • Delete both the Prettier and Svelte VSCode extensions
  • Restart VSCode and reinstalled extensions
  • Restart VSCode and it's working!

Hopefully this is useful for someone, and thanks to @SvelteSociety for the kick to blog it!