Open rangersss opened 1 year ago
Tried with node v18.15.0
on OSX
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?
I just figured out what was causing this error in my context.
After 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.
// tsconfig.json
{
"extends": [
"@tsconfig/node12"
],
"compilerOptions": {
// configs ...
}
}
dwesley@DESKTOP-R4V89G6:~/www/new-beecrowd$ git commit -m "TEST"
→ No staged files match any configured task.
--- COMMIT-MSG HOOK ---
/home/dwesley/www/new-beecrowd/node_modules/@commitlint/cli/lib/cli.js:123
throw err;
^
TypeError: value.replace is not a function
at normalizeSlashes (/home/dwesley/www/new-beecrowd/node_modules/ts-node/dist/util.js:62:18)
at Object.getExtendsConfigPath (/home/dwesley/www/new-beecrowd/node_modules/ts-node/dist/ts-internals.js:24:54)
at readConfig (/home/dwesley/www/new-beecrowd/node_modules/ts-node/dist/configuration.js:127:64)
at findAndReadConfig (/home/dwesley/www/new-beecrowd/node_modules/ts-node/dist/configuration.js:50:84)
at create (/home/dwesley/www/new-beecrowd/node_modules/ts-node/dist/index.js:146:69)
at register (/home/dwesley/www/new-beecrowd/node_modules/ts-node/dist/index.js:127:19)
at TypeScriptLoader (/home/dwesley/www/new-beecrowd/node_modules/cosmiconfig-typescript-loader/dist/cjs/index.js:52:54)
at loadConfig (/home/dwesley/www/new-beecrowd/node_modules/@commitlint/load/lib/utils/load-config.js:12:75)
at load (/home/dwesley/www/new-beecrowd/node_modules/@commitlint/load/lib/load.js:19:55)
at main (/home/dwesley/www/new-beecrowd/node_modules/@commitlint/cli/lib/cli.js:194:45)
Node.js v18.15.0
husky - commit-msg hook exited with code 1 (error)
By removing this specific setting, everything went back to normal.
// tsconfig.json
{
"extends": [
// "@tsconfig/node12"
],
"compilerOptions": {
// configs ...
}
}
dwesley@DESKTOP-R4V89G6:~/www/new-beecrowd$ git commit -m "TEST"
→ No staged files match any configured task.
--- COMMIT-MSG HOOK ---
⧗ input: TEST
✖ 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
husky - commit-msg hook exited with code 1 (error)
I believe that, somehow, my project settings interfered with the execution of the lib. Ideally, this shouldn't happen. I believe this error is a point that the lib should resolve permanently.
@DavidWesley your issue sounds like #3256
@rangersss issue could be something else. Not sure.
@DavidWesley your issue sounds like #3256 @rangersss issue could be something else. Not sure.
The problem is the npm package
Sure, but is it the same as #3256 ?
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.
If your issue is about pnpm vs. yarn this is a different issue.
It looks like a problem with typescript v5 and https://github.com/TypeStrong/ts-node/pull/1958, ts-node is currently not supporting extends as array
~Please see if the latest release fixes this: https://github.com/conventional-changelog/commitlint/releases/tag/v17.7.0~
See #3641 This will then hopefully be fixed with a new mayor version. yolo
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
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