prettier / prettier-emacs

Minor mode to format JS code on file save

Home Page:http://jlongster.com/A-Prettier-Formatter

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Not working with prettier 3.0.1

atuleu opened this issue · comments

Since prettier v3.0.1 this package is not working

Given a svelte file

<script>
        import '@skeletonlabs/skeleton/themes/themes-skeleton.css';
        import '@skeletonlabs/skeleton/styles/skeleton.css';
        import '../app.postcss';
</script>

<slot />

The emacs command M-x prettier-js is returning the error:

prettier errors:
[warn] Ignored unknown option --stdin.
[warn] Ignored unknown option { pluginSearchDirs: ["."] }.
[error] /home/atuleu/devel/github.com/formicidae-tracker/formicidae-tracker.github.io/src/routes/+layout.svelte: Error: printer.embed has too many parameters. The API changed in Prettier v3. Please update your plugin. See https://prettier.io/docs/en/plugins.html#optional-embed
[error]     at printEmbeddedLanguages (file:///home/atuleu/.nvm/versions/node/v18.17.0/lib/node_modules/prettier/index.mjs:17595:11)
[error]     at printAstToDoc (file:///home/atuleu/.nvm/versions/node/v18.17.0/lib/node_modules/prettier/index.mjs:17726:9)
[error]     at async coreFormat (file:///home/atuleu/.nvm/versions/node/v18.17.0/lib/node_modules/prettier/index.mjs:18037:14)
[error]     at async formatWithCursor (file:///home/atuleu/.nvm/versions/node/v18.17.0/lib/node_modules/prettier/index.mjs:18235:\
    14)
[error]     at async formatStdin (file:///home/atuleu/.nvm/versions/node/v18.17.0/lib/node_modules/prettier/internal/cli.mjs:6689:23) 
[error]     at async main (file:///home/atuleu/.nvm/versions/node/v18.17.0/lib/node_modules/prettier/internal/cli.mjs:6972:5)
[error]     at async Module.run (file:///home/atuleu/.nvm/versions/node/v18.17.0/lib/node_modules/prettier/internal/cli.mjs:6928:5)                                                                                                                                

Running npm install -g prettier@2 solved the issue. I guess version 3 removed some options from prettier and this package should be updated.

p.s.: the { pluginSearchDirs: ["."] } comes from svelte default .prettierrc file.

bump

I'd like to contribute to this somehow, if anyone's got any idea. I don't think it'd get merged, since I couldn't find any PRs closed since 2020