sveltejs / prettier-plugin-svelte

Format your svelte components using prettier.
MIT License
744 stars 97 forks source link

formatting a svelte file with this plugin breaks everything #470

Open Oudwins opened 1 week ago

Oudwins commented 1 week ago

When I try to format a svelte file with prettier and this plugin using format on save with vscode the entire file breaks. When I try to run prettier with the --write flag it reports a parsing error. If I format the file using the vscode extension for svelte nothing breaks.

Specifically what breaks are the arrow functions and a few other things. I have created a minimal repository reproducing the issues -> https://github.com/oudwin-old/prettier-plugin-svelte-error.

Other relevant data versions

  "devDependencies": {
    "prettier": "^3.3.3",
    "prettier-plugin-svelte": "^3.2.7",
    "prettier-plugin-tailwindcss": "^0.6.8"
    // I am using svelte 4
   // svelte vs code plugin version is v109.1.0
  }

prettier.config.js

module.exports = {
  semi: true,
  tabWidth: 2,
  plugins: ["prettier-plugin-svelte", "prettier-plugin-tailwindcss"],
  //svelteStrictMode: true,
  overrides: [
    {
      files: "*.svelte",
      options: {
        parser: "svelte",
      },
    },
  ],
};
Oudwins commented 1 week ago

Also, this is not an issue with the tailwind plugin because I have tried to remove it and it still happens. And Its also not an issue with the properties not being quoted since I removed the quotes thinking that was the cause and the error persists