Skip to content

fix: passing a non existing working directory does nothing and returns with exit code 0 #4595

@j-be

Description

@j-be

Steps to Reproduce

1. Create an empty folder and `cd` into it
2. `npm install -D @commitlint/cli @commitlint/config-conventional`
3. npx commitlint --to doesNotMatter -d doesNotExist

Current Behavior

commitlint does nothing at all and returns with exit code 0 (=zero).

Expected Behavior

commitlint logs an error, that the given working directory cannot be found and returns with a non-zero exit code.

Affected packages

  • cli
  • core
  • prompt
  • config-angular

Possible Solution

If a working directory is explicitly given with -d or --cwd, validate the directory actually exists and if not error out.

Context

I think it is bad default behavior for a linter to accept invalid working directory as parameter and just silently ignore it and do nothing at all.

commitlint --version

@commitlint/[email protected]

git --version

irrelevant

node --version

v24.11.1

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions