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

What is this plugin for? #11

Closed
vedantroy opened this issue Feb 22, 2022 · 5 comments
Closed

What is this plugin for? #11

vedantroy opened this issue Feb 22, 2022 · 5 comments

Comments

@vedantroy
Copy link

I feel a bit silly, I found this plugin b/c it helped me use dprint with svelte & astro.

But I'm wondering what does this plugin actually do? If it runs prettier, won't that make the speed benefits of dprint useless?

@dsherret
Copy link
Member

The main thing is it allows you to have format with prettier via dprint's CLI, which may be useful if you're using other dprint plugins and want to run everything from a single CLI.

Beyond that, it should be faster because dprint's CLI will cause multiple file formats to run in parallel and if you're using the incremental feature (https://dprint.dev/config/#incremental) it will only format files that have changed.

@vedantroy
Copy link
Author

Thanks for the response.

So to clarify, this plugin will mean that dprint will format most files, but prettier will format the files that dprint doesn't support (e.g: svelte)?

@dsherret
Copy link
Member

dsherret commented Feb 23, 2022

Not exactly. Dprint's CLI has no clue about how to format any kind of file. The plugins do that. So if you use the prettier plugin then it will format using prettier. If you use another plugin like dprint-plugin-typescript in addition to dprint-plugin-prettier, then you can get it formatting JavaScript and TypeScript code with dprint-plugin-typescript by putting the url for dprint-plugin-typescript before dprint-plugin-prettier's url in the plugins array of the configuration file.

@vedantroy
Copy link
Author

vedantroy commented Feb 23, 2022

Got it. I think it might be worth adding a line to the README that says to put this plugin last.
Otherwise, people might put it first and end up formatting everything with prettier (I did this).

@dsherret
Copy link
Member

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

No branches or pull requests

2 participants