Closed
Description
I notice that commitlint cli in versions 8.3.0 and onwards, you're using read-pkg version 5.2.0.
Please be aware that there is a significant API change in that module starting at version 4.0.0. The read-pkg API was changed to accept an options objection where one of it's keys, cwd
, specifies the directory of the package.json to read. If not specified, it will default to the current directory that commitlint is run from. This is buggy since I believe you actually want to read the package.json where commitlint is installed.
Expected Behavior
commitlint >= 8.3.0 reads package.json from install area
Current Behavior
commitlint >= 8.3.0 reads package.json from current workding directory:
cd $HOME
[hvo@hvo-mac ~]$ npx commitlint
/Users/hvo/.nvm/versions/node/v10.18.0/lib/node_modules/commitlint/node_modules/@commitlint/cli
ENOENT: no such file or directory, open '/Users/hvo/package.json'
Affected packages
- [ x ] cli
- core
- prompt
- config-angular
Possible Solution
downgrade read-pkg to 3.0.0
update the CLI to correctly use the new read-pkg API