conventional-changelog / conventional-changelog/commitlint

Error: Keyword [object Object] is not a valid identifier

Open
#3,407 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
18.7k
Forks
970
Avg merge
7h 33m
Merged PRs (30d)
49

Description

My commit hook fails with any combination of message. It looks like it's an error integrating with the AJV module. Here are some commits I've tried plus the stack trace.

`git commit -m "chore: lint on commit"`
`git commit -m "foo: this will fail"`
`git commit -m "feat(thing): makes updates to the thing"`

```
xxx/node_modules/ajv/lib/keyword.js:30
throw new Error('Keyword ' + keyword + ' is not a valid identifier');
^
Error: Keyword [object Object] is not a valid identifier
at Ajv.addKeyword (xxx/node_modules/ajv/lib/keyword.js:30:11)
at validateConfig (xxx/node_modules/@commitlint/config-validator/src/validate.ts:28:6)
at load (xxx/node_modules/@commitlint/load/src/load.ts:29:17)
at async main (xxx/node_modules/@commitlint/cli/src/cli.ts:208:17)
husky - commit-msg hook exited with code 1 (error)
```

## Expected Behavior

I'd expect to see the commits succeed and fail based on their validity.

## Current Behavior

It looks to me like a there's a parsing error. The stack trace makes me think it's a problem integrating with the AJV library. I'm working in a private repo so I can't share the source code. 😅

`package.json`
```
{
...
"husky": {
"hooks": {
...
"commit-msg": "npx commitlint -E HUSKY_GIT_PARAMS"
}
},
"resolutions": {
"ajv": "6.12.5"
},
"devDependencies": {
...
"@commitlint/cli": "17.1.2",
"@commitlint/config-conventional": "17.1.0",
"@commitlint/prompt-cli": "17.1.2",
"husky": "^8.0.1",
...
}
```

## Affected packages

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

## Steps to Reproduce (for bugs)

1. With the above deps make changes to a file
2. Try to commit with any of the above commit messages

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.