conventional-changelog / conventional-changelog/commitlint
fix: SyntaxError: Invalid or unexpected token. commit-msg run error.
- Dominant language
- TypeScript
- Stars
- 18.7k
- Forks
- 970
- Avg merge
- 7h 33m
- Merged PRs (30d)
- 49
Description
### Expected Behavior
PS E:\all_project\original-detection> git commit -m 'test commit-msg'
→ No staged files match any configured task.
E:\all_project\original-detection\node_modules\.pnpm\@commitlint+read@17.5.1\node_modules\@commitlint\read\lib\read.js:1
SyntaxError: Invalid or unexpected token
at internalCompileFunction (node:internal/vm:73:18)
at wrapSafe (node:internal/modules/cjs/loader:1176:20)
at Module._compile (node:internal/modules/cjs/loader:1218:27)
at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)
at Module.load (node:internal/modules/cjs/loader:1117:32)
at Module._load (node:internal/modules/cjs/loader:958:12)
at Module.require (node:internal/modules/cjs/loader:1141:19)
at require (node:internal/modules/cjs/helpers:110:18)
at Object. (E:\all_project\original-detection\node_modules\.pnpm\@commitlint+cli@17.6.1\node_modules\@commitlint\cli\lib\cli.js:16:32)
at Module._compile (node:internal/modules/cjs/loader:1254:14)
Node.js v18.16.0
husky - commit-msg hook exited with code 1 (error)
### Current Behavior
_No response_
### Affected packages
- [ ] cli
- [ ] core
- [ ] prompt
- [ ] config-angular
### Possible Solution
_No response_
### Steps to Reproduce
```bash
1. pnpm add @commitlint/config-conventional @commitlint/cli husky
2. echo "module.exports = {extends: ['@commitlint/config-conventional']}" > commitlint.config.js
3. npx husky install
4. npx husky add .husky/commit-msg 'npx --no -- commitlint --edit ${1}'
5. git add .
6. git commit -m 'test pre-commit'
```
### Context
verify commit message
### commitlint --version
"@commitlint/cli": "^17.6.1"
### git --version
git version 2.37.3.windows.1
### node --version
v18.16.0
Contributor guide
Assessment
This issue has not been assessed yet.