docs-ts icon indicating copy to clipboard operation
docs-ts copied to clipboard

Prettier as peer dependency prevents upgrading it in consumers projects

Open StefanoMagrassi opened this issue 2 years ago • 3 comments

Do you want to request a feature or report a bug?

It seems to be a bug

What is the current behavior?

Prettier ^2.0.0 is required as peer dependency and it is used in runtime code.

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem via https://codesandbox.io/ or similar.

Prettier cannot be upgraded to v3 in a project that uses docs-ts as dependency:

npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/prettier
npm ERR!   dev prettier@"3.0.0" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer prettier@"^2.0.0" from [email protected]
npm ERR! node_modules/docs-ts
npm ERR!   dev docs-ts@"0.8.0" from the root project
npm ERR! 
npm ERR! Conflicting peer dependency: [email protected]
npm ERR! node_modules/prettier
npm ERR!   peer prettier@"^2.0.0" from [email protected]
npm ERR!   node_modules/docs-ts
npm ERR!     dev docs-ts@"0.8.0" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

What is the expected behavior?

Users should be able to upgrade Prettier to v3 (or further versions) and docs-ts should still work.

Which versions of docs-ts, and which browser and OS are affected by this issue? Did this work in previous versions of docs-ts?

  • docs-ts v0.8.0
  • any browser
  • any OS

StefanoMagrassi avatar Jul 18 '23 10:07 StefanoMagrassi

@gcanti if Prettier is still a fundamental part of doc-ts, it should be declared as dependency (not peer) in order to be available even if the the user wants to upgrade it in his/her project

StefanoMagrassi avatar Jul 18 '23 10:07 StefanoMagrassi

related #22

StefanoMagrassi avatar Jul 18 '23 12:07 StefanoMagrassi