commitlint icon indicating copy to clipboard operation
commitlint copied to clipboard

fix: dependencies tree for typing needs fine-tunning

Open eladchen opened this issue 1 year ago • 2 comments

Steps to Reproduce

  1. In a new typescript project install the following:

typescript@latest @commitlint/[email protected] [email protected]

  1. import conventional-commits-parser and notice how the types are missing

Current Behavior

When Installing @commitlint/[email protected] @commitlint/[email protected] is also installed

https://github.com/conventional-changelog/commitlint/blob/master/%40commitlint/cli/package.json#L55C6-L55C23

Which breaks typing when [email protected] is installed.

typescript will complain about commit parser having no exported member 'CommitParser' import { CommitParser } from "conventional-commits-parser";

https://github.com/conventional-changelog/conventional-changelog/blob/d3b8aaa16337993bbad4d91db1ffac5a7568756b/packages/conventional-commits-parser/src/CommitParser.ts#L42

Expected Behavior

Installing @commitlint/cli & conventional-commits-parser should result in the correct typings

Affected packages

  • [X] cli
  • [ ] core
  • [ ] prompt
  • [ ] config-angular

Possible Solution

No response

Context

No response

commitlint --version

@commitlint/[email protected]

git --version

2.41.0

node --version

22.4.0

eladchen avatar Jul 28 '24 05:07 eladchen

The workaround I'm using is to add the below entry to the tsconfig file

"paths": {
      "conventional-commits-parser": [
        "node_modules/conventional-commits-parser/dist"
      ]
},

eladchen avatar Jul 28 '24 05:07 eladchen

The PR to support v6 is still open: #4064
Happy for help

escapedcat avatar Jul 29 '24 08:07 escapedcat