Thinkmill / manypkg

☔️ An umbrella for your monorepo
MIT License
914 stars 49 forks source link

`manypkg check` shouldn't warn to mirror `peerDependencies` into `devDependencies` when they're already available in the root's `dependencies`. #88

Open threepointone opened 3 years ago

threepointone commented 3 years ago

That's a long title, but let me explain.

The broad rule that manypkg warns about, is that anything in peerDependencies, should also be in devDependencies. This is reasonable (and imo also correct).

However, in a monorepo (i.e. something using workspaces), root level dependencies are used as a substitute for package level devDependencies. This keeps it easier to keep the versioning of those deps across workspaces simple, and avoids repeating them across workspaces.

Hence my feature request: You shouldn't warn about mirroring peerDependencies and devDependencies if it's already available in a root's dependencies. It should still do a version check ("External Mistmatch" rule), however.

emmatown commented 3 years ago

This sounds good, happy to accept a PR for it

threepointone commented 3 years ago

I will work on this (maybe a little slowly haha), unless someone gets to it before me. Thank you!

jroebu14 commented 3 years ago

Hello. I like your suggestion @threepointone but I'm thinking it would make more sense to choose one rule and not allow a combination of both because I think this would mean people would have to arbitrarily decide where to put dependencies - the package devDependencies or the root dependencies.

My thinking was inspired by the "Root has devDependencies" check:

The root package.json of a monorepo is not published so whether a dependency is in devDependencies or dependencies does not make a difference and having one place to put dependencies in the root means that people do not have to arbitrarily decide where a dependency should go every time they install one.

slavagoreev commented 3 years ago

@threepointone this feature will be highly appreciated!

steve-taylor commented 2 years ago

Not all monorepos that use Manypkg have all dependencies hoisted to the root. I'd like this to be an option to ignore the rule, rather than removing this entirely.