-
Notifications
You must be signed in to change notification settings - Fork 914
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error when used with Husky: "Please add rules to your commitlint.config.js" #583
Comments
Looks like this change in behavior has been introduced after version 7.2.1. When I use version 7.5.2, I start getting the error message mentioned earlier: "Please add rules to your commitlint.config.js". I looked through the change log, but there is no mention of it, |
The warning about a missing commitlint versions 7.2.1 and older essentially allowed any commit message to go through when no config was provided. To avoid the confusion around this and make sure users actually get what they want from commitlint we introduced the warning. Feel free to reopen if you think there is a problem not covered by my explanation. |
Thanks for clarifying @marionebl. It makes total sense 👍 |
Not to re-open this issue, but I'm receiving the same error, but I actually use a global For some reason though, the interaction between Husky and Commitlint fails to read this global file. |
In my case, I was following guidelines from https://commitlint.js.org/#/ So, fix for me was to remove these not needed double quotes and make the file contents syntactically correct as per JavaScript. |
For those who try to use the file as TS, it won't work, after switching to JS it ran normally for me. So use this... |
Which version did you use. TS configs should work at leats for the current version: It migh t be a new bug if these don't work. |
Hi @escapedcat, were these versions...
|
Alright, thanks. Would you mind opening a new issue for that? |
Dude, I'm pretty wrapped up with a new project, if you want to do it, feel free |
Works for me on TS 5.3 commit-msg #!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
npx --no -- commitlint --edit ${1} commitlint.config.ts import type { UserConfig } from '@commitlint/types';
const Configuration: UserConfig = {
extends: ['@commitlint/config-conventional'],
// yand add -D @commitlint/format
formatter: '@commitlint/format',
helpUrl: 'https://github.com/conventional-changelog/commitlint/#what-is-commitlint',
};
module.exports = Configuration; |
Expected Behavior
The following Husky hook used to work perfectly with "@commitlint/cli": "^7.2.1" and "husky": "^1.2.1"
Current Behavior
Today I started getting the following error:
I have never needed this file before!
Affected packages
Possible Solution
I added the commitlint.config.js file to fix the problem, but it seems mysterious how this started appearing suddenly.
Note: I do not understand how HUSKY_GIT_PARAMS works. The husky documents do not quite explain it.
Steps to Reproduce (for bugs)
You can see my fixed project here: https://github.com/archfirst/joinjs. The previous commit did not work.
The text was updated successfully, but these errors were encountered: