Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix: commitlint --extends is ignored for commitlint/config-conventional (v18.6.1) #3909

Closed
1 of 4 tasks
nwrkbiz opened this issue Feb 13, 2024 · 12 comments · Fixed by #3911
Closed
1 of 4 tasks

fix: commitlint --extends is ignored for commitlint/config-conventional (v18.6.1) #3909

nwrkbiz opened this issue Feb 13, 2024 · 12 comments · Fixed by #3911
Labels

Comments

@nwrkbiz
Copy link

nwrkbiz commented Feb 13, 2024

Expected Behavior

Commits shall be linted.

Current Behavior

Error: Please add rules to your commitlint.config.js

Affected packages

  • cli
  • core
  • prompt
  • config-angular

Possible Solution

No response

Steps to Reproduce

npm install -g @commitlint/cli @commitlint/config-conventional
commitlint -V --extends @commitlint/config-conventional --from=HEAD~1 --to HEAD

Context

The steps to reproduce worked in the last version (18.6.0)

commitlint --version

@commitlint/cli@18.6.1

git --version

2.39.2

node --version

10.2.3

@nwrkbiz nwrkbiz added the bug label Feb 13, 2024
@nwrkbiz
Copy link
Author

nwrkbiz commented Feb 13, 2024

I could narrow this down: The problem is caused by the @commitlint/config-conventional@18.6.1 package if I dowgrade this to @commitlint/config-conventional@18.6.0 everything works again.

@nwrkbiz
Copy link
Author

nwrkbiz commented Feb 13, 2024

Looks like the refactoring to typescript caused the problem: 345bcf5

In js the ruleset was defined in module.exports in typescript everything now is in exports.config.

@escapedcat
Copy link
Member

The PR creator was informed. Happy for anyone else who wants to fix this.

@dargmuesli
Copy link
Contributor

Something like this? #3911

@damienbutt
Copy link

damienbutt commented Feb 13, 2024

I've always used a .commitlintrc.json for my config.

{
    "extends": ["@commitlint/config-conventional"]
}

Executing commitlint via a commit-msg hook using Husky.

#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

pnpm commitlint --edit $1

On 18.6.0, this works.

But on 18.6.1, it breaks.

✖   Please add rules to your `commitlint.config.js`
    - Getting started guide: https://commitlint.js.org/#/?id=getting-started
    - Example config: https://github.com/conventional-changelog/commitlint/blob/master/%40commitlint/config-conventional/src/index.ts [empty-rules]

✖   found 1 problems, 0 warnings
ⓘ   Get help: https://github.com/conventional-changelog/commitlint/#what-is-commitlint

Running it from the CLI produces the same error.

echo "chore: bump deps" | pnpm commitlint
✖   Please add rules to your `commitlint.config.js`
    - Getting started guide: https://commitlint.js.org/#/?id=getting-started
    - Example config: https://github.com/conventional-changelog/commitlint/blob/master/%40commitlint/config-conventional/src/index.ts [empty-rules]

✖   found 1 problems, 0 warnings
ⓘ   Get help: https://github.com/conventional-changelog/commitlint/#what-is-commitlint

Re-added this as realised it only relates to 18.6.1. 18.6.0 works as expected.

@escapedcat

This comment was marked as off-topic.

@escapedcat escapedcat changed the title fix: commitlint --extends is ignored for commitlint/config-conventional fix: commitlint --extends is ignored for commitlint/config-conventional (v18.6.1) Feb 13, 2024
@ryancausey
Copy link

It looks like this broke my CI as well.

$ npm install --global @commitlint/config-conventional @commitlint/cli
added 199 packages in 8s
31 packages are looking for funding
  run `npm fund` for details
$ npm --version
10.2.4
$ export COMMITS_IN_BRANCH=$(git rev-list $CI_MERGE_REQUEST_DIFF_BASE_SHA..$CI_COMMIT_SHA | wc --lines)
$ export BACKREFERENCE_COUNT=$(($COMMITS_IN_BRANCH - 1))
$ npx commitlint --verbose --from HEAD~$BACKREFERENCE_COUNT
✖   Please add rules to your `commitlint.config.js`
    - Getting started guide: https://commitlint.js.org/#/?id=getting-started
    - Example config: https://github.com/conventional-changelog/commitlint/blob/master/%40commitlint/config-conventional/src/index.ts [empty-rules]
✖   found 1 problems, 0 warnings
ⓘ   Get help: https://github.com/conventional-changelog/commitlint/#what-is-commitlint
Cleaning up project directory and file based variables 00:00
ERROR: Job failed: exit code 1

I have a .commitlintrc.yml at the root of the repository that it normally picks up fine.

@escapedcat
Copy link
Member

Please give this a try:
https://github.com/conventional-changelog/commitlint/releases/tag/v18.6.2

Thanks to @dargmuesli for jumping in and @masterT, @jerome-benoit and @knocte for review and feedback!

@jerome-benoit
Copy link

Please give this a try: https://github.com/conventional-changelog/commitlint/releases/tag/v18.6.2

So far, so good on all the ESM repos I use that was broken by the previous release.

Thanks.

@mlazari
Copy link

mlazari commented Feb 14, 2024

18.6.2 works for me, thank you!

@masterT
Copy link

masterT commented Feb 14, 2024

Same here, it's working with 18.6.2, thanks! 🙂

@mdwekat
Copy link

mdwekat commented Feb 19, 2024

+1

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Development

Successfully merging a pull request may close this issue.

9 participants