conventional-changelog / commitlint

📓 Lint commit messages
https://commitlint.js.org
MIT License
16.64k stars 892 forks source link

Peer dependency warnings for @types/node #3007

Closed jrolfs closed 2 years ago

jrolfs commented 2 years ago

Depending on @commitlint/prompt or @commitlint/cli results in peer dependency warnings because the @types/node peer dependency of cosmiconfig-typescript-loader is not satisfied in @commitlint/load

Depending on @commitlint/prompt or @commitlint/cli should not result in any peer dependency warnings.

Depending on @commitlint/prompt or @commitlint/cli results in peer dependency warnings.

peer-dependency-warning

Affected packages

Possible Solution

Either expose @types/node as a peer dependency of @commitlint/load and then of @commitlint/cli and @commitlint/prompt, or add @types/node as a dependency of @commitlint/load.

I'd be happy to open a pull request for this, but am curious if there's a preference as to how we resolve this (see above).

Steps to Reproduce (for bugs)

  1. yarn init
  2. yarn add @commitlint/cli
reproduce

Context

Consolidate all JavaScript tooling into a single package https://github.com/hoverinc/hover-javascript/

Your Environment

Executable Version
commitlint --version 16.1.0
git --version 1.33.0
node --version 16.13.0
escapedcat commented 2 years ago

Thanks @jrolfs !

I'd be happy to open a pull request for this, but am curious if there's a preference as to how we resolve this (see above).

That would be nice, yeah. I think adding the package as a dev-dependency like we do in the other packages should be fine, what do you think?

Maybe also align the versions when you are on it anways. Looks like we have these two different versions atm:

I guess these could just be the same.

jrolfs commented 2 years ago

It would have to be a peer dependency (and therefore a peer dependency of cli and prompt) or direct dependency to resolve the issue. I think the peer dependency route would have to be a breaking change for both @commitlint/cli and @commitlint/prompt so maybe adding it as a direct dependency of @commitlint/load with a permissive range would be the best solution?

escapedcat commented 2 years ago

so maybe adding it as a direct dependency of @commitlint/load with a permissive range would be the best solution?

Got it, sounds good to me. Wanna give it a try?

jrolfs commented 2 years ago

Maybe also align the versions when you are on it anways. Looks like we have these two different versions atm:

"@types/node": "^12.20.27", "@types/node": "12.20.43",

I guess these could just be the same.

Also, I use manypkg in my monorepos to keep dependencies aligned. I could open another PR to add that here but there a quite a few fixes it would make:

manypkg check
escapedcat commented 2 years ago

Also, I use manypkg in my monorepos to keep dependencies aligned. I could open another PR to add that here but there a quite a few fixes it would make:

Didn't know the tool. Sounds good. Happy for a PR.
You think we should chose the higher working versions? I.e. chalk@^4.1.0 instead of the suggested chalk@^4.0.0?

escapedcat commented 2 years ago

Released with v16.2.1

GlennM commented 2 weeks ago

My yarn explain peer-requirements currently complains about the following; which might be related to this original issue?