-
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
ERR_REQUIRE_ESM when using Node.js ESM in tandem with TypeScript config (commitlint.config.ts) #3251
Comments
Thanks for raising this |
Same problem and I'm agree with @shian15810 's described context.
I also prefer |
We also have the same issue after migrating to ESM, can confirm that renaming |
This comment was marked as duplicate.
This comment was marked as duplicate.
- conventional-changelog/commitlint#3251 오류로 인해 `.cjs` 확장과 jsdoc 타입 체크로 대신함 - 커밋 메시지에 한글을 사용하므로, 영어 케이스 규칙은 사용하지 않음
Renaming
So currently commitlint doesn't support |
#3461 might help. It was just merged but not yet released. |
It didn't work for me. This is my case, it is not a direct dependency, it is a
It seems to be a bug related to Is there any development on this?
Thank you! |
At least for me, It solved the problem. |
@SalahAdDin Thanks for your feedback. Let's close this for now. |
The issue persists, not sure why this got closed. Adding support for I have a (Renaming file to |
Yep. Thanks for raising this up. I would also like commitlint to respect |
Happy for a PR |
I changed |
@alextnetto can confirm that with following contents of
still throws an error:
Though I tried
@DamianGlowala can you confirm that now commitlint Maybe it's issue with cosmic config or ts loader itself? From where this difference between UPD: Oh.. this is probably related to already mentioned TypeStrong/ts-node#1007 issue. So.. This can be closed now? @escapedcat what do you think? |
@ZerdoX-x thanks for digging and confirming. If there's nothing we can do on our side we could close this again. |
I think yes, this can be closed, no response from other guys within a week. I am sure it's blocked by ts-node issue mentioned above |
@ZerdoX-x For .js you can use this on the config file.
For me, it worked fine after that. |
@alextnetto yep, I know. but originally the issue about Personally using
|
may be related to this cosmiconfig/cosmiconfig#312 |
@newives yes, i got this same error and the issue is cosmiconfig since it require()s the config, the craetor says it will be fixed so commitlint needs to update it once its fixed. |
for now, we can just set a package resolution override to |
stylelint/stylelint#7329 seems to have fixed the problem. I don’t know if it helps. |
Is this still an error with commitlint@18.2.0? ts-node was removed as a dependency with: v18.1.0...v18.2.0 |
It is estimated that #3776 has been fixed. If possible, publish a version so I can test it. |
@joberstein Very nicely done❤️ |
Thank you very much! |
Thankful. It worked for me. |
Updating commitlint cli fixed this for me, also hi @escapedcat ! 😁 |
Expected Behavior
With the given setup above, executing
npx commitlint --to HEAD
should not result inERR_REQUIRE_ESM
error.Current Behavior
Currently, the above setup is giving the following output:
Affected packages
Possible Solution
commitlint.config.cts
, orimport()
to load configSteps to Reproduce (for bugs)
commitlint
according to the official documentation withpackage.json
andtsconfig.json
supplied above.npx commitlint --to HEAD
.commitlint.config.ts
Context
Without touching
tsconfig.json
, if I remove"type": "module"
frompackage.json
,npx commitlint --to HEAD
can be executed successfully.But this is not plausible since I have migrated the whole repository to Node.js ESM since the release of TypeScript 4.7 officially supporting it.
Raising this issue as people with similar setup will encounter this as well.
Currently resorted to using
commitlint.config.cjs
, but still prefer to havecommitlint.config.ts
in the long run.Your Environment
commitlint --version
git --version
node --version
The text was updated successfully, but these errors were encountered: