-
Notifications
You must be signed in to change notification settings - Fork 9
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
Make Prettier and Biome optional peer dependencies #19
Comments
I like the idea of not installing Biome packages if I don't use them, but there are a few things to consider:
Given these points, we should consider the following steps:
This approach would improve the current situation and set the groundwork for potentially making the formatters optional in the future. What do you think about tackling these points first, @AlemTuzlak? |
Thanks for the elaboration. Sounds to me like there isn't much leeway here, I was hoping that making them optional would be straightforward. What about moving towards formatting them only if there is a formatter installed? So that by default there's indeed no formatting, and Prettier truly can truly become optional. Otherwise I don't see much point in these optimizations if only Biome can be extracted out, doesn't feel like much of a gain. Provided that the maintainers are interested in optimizing their package size. |
@sairus2k thank you for the detailed write-up, to answer your points:
I fully agree, another option would be to completely remove formatting, maybe it should be left to the project owners themselves to lint the files, also what's important to note is that this is a devDep and none of these deps end up in your prod bundle so it's not as big of an impact on your app. What do you guys think? |
Nevertheless it's still something that CI has to install, and you'll likely end up with two different versions of Prettier. One easy solution that comes to mind is setting Prettier dependency to What do you think? |
Although this is very new, it may be what you're looking for 😄 |
@achou11 wow this is exatly what I'm looking for lol |
Personally, I don't have much of a problem with removing formatting functionality if that's something you decide to pursue 👍 |
What do you think of making Prettier and Biome optional dependencies, and conditionally importing whichever one is selected as the formatter? That way people get to install Prettier or Biome version they want, or none.
I've never done this before, but it seems like marking them as optional peer dependencies would be the way to go in that scenario using
peerDependenciesMeta
. ChatGPT says that npm v7+ supports this, and that only Yarn v1 would print out warnings for unmetpeerDependencies
, which seems like a small price to pay.The text was updated successfully, but these errors were encountered: