Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

formatting a svelte file with this plugin breaks everything #470

Open
Oudwins opened this issue Nov 5, 2024 · 2 comments
Open

formatting a svelte file with this plugin breaks everything #470

Oudwins opened this issue Nov 5, 2024 · 2 comments

Comments

@Oudwins
Copy link

Oudwins commented Nov 5, 2024

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
Copy link
Author

Oudwins commented Nov 5, 2024

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

@dummdidumm
Copy link
Member

If I remove prettier-plugin-tailwindcss from the list of plugins in your repro, the error is no longer reproducible. So to me this looks like prettier-plugin-tailwindcss is the culprit.
You said that it's reproducible even if you remove that plugin; if that's the case please provide a file where that happens even with that plugin removed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants