-
Notifications
You must be signed in to change notification settings - Fork 909
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
fix: SyntaxError: Invalid or unexpected token. commit-msg run error. #3588
Comments
Tried with echo "test pre-commit" | npx commitlint
⧗ input: test pre-commit
✖ subject may not be empty [subject-empty]
✖ type may not be empty [type-empty]
✖ found 2 problems, 0 warnings
ⓘ Get help: https://github.com/conventional-changelog/commitlint/#what-is-commitlint Did you search the existing issues already? Might be one of these: |
I got the same bug. Any one else solve this bug? |
ProblemAfter hours of reading documentation for errors in husky, lint-staged and commitlint, none of them worked. I found that what was preventing the commitlint cli from working was the my tsconfig file. Configuration file// tsconfig.json
{
"extends": [
"@tsconfig/node12"
],
"compilerOptions": {
// configs ...
}
} Prompt
SolutionBy removing this specific setting, everything went back to normal. Configuration file// tsconfig.json
{
"extends": [
// "@tsconfig/node12"
],
"compilerOptions": {
// configs ...
}
} Prompt
SuggestionI believe that, somehow, my project settings interfered with the execution of the lib. |
@DavidWesley your issue sounds like #3256 |
The problem is the npm package |
Sure, but is it the same as #3256 ? |
Yes, because there may be some problem with the package when downloading with pnpm before, and then there will be no problem after re-downloading the package with yarn! |
Sorry, I do not understand. |
It looks like a problem with typescript v5 and TypeStrong/ts-node#1958, ts-node is currently not supporting extends as array |
See #3641 |
Is this fixed? |
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@[email protected]\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@[email protected]\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
Possible Solution
No response
Steps to Reproduce
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
The text was updated successfully, but these errors were encountered: