-
-
Notifications
You must be signed in to change notification settings - Fork 17
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
Installation of the hook fails with Error [ERR_REQUIRE_ESM] #152
Comments
Hi there, this a weird once since this module is not ESM nor it does any |
I do not have a project.json as the project is python. |
I found out that @commitlint/config-angular and other configs backed by their repo recently (in v19) switched to ESM, so it may be related. https://github.com/conventional-changelog/commitlint/releases/tag/v19.0.0 |
Yeah that's probably it, ESM interop is always fun. I guess I could modify this package to be ESM by adding |
Any workaround for the time being? Experiencing same thing, here's our config: const Configuration = {
extends: ['@commitlint/config-conventional'],
rules: {
"header-max-length": [2, "always", 72], // To show full header in github
"subject-case": [2, "always", "sentence-case"], // To look consistent in auto-generated changelog
"scope-enum": [2, "always"],
},
/*
* Array of functions that return true if commitlint should ignore the given message.
* Given array is merged with predefined functions, which consist of matchers like:
*
* - 'Merge pull request', 'Merge X into Y' or 'Merge branch X'
* - 'Revert X'
* - 'v1.2.3' (ie semver matcher)
* - 'Automatic merge X' or 'Auto-merged X into Y'
*
* To see full list, check https://github.com/conventional-changelog/commitlint/blob/master/%40commitlint/is-ignored/src/defaults.ts.
* To disable those ignores and run rules always, set `defaultIgnores: false` as shown below.
*/
ignores: [(commit) => commit === ''],
/*
* Whether commitlint uses the default ignore rules, see the description above.
*/
defaultIgnores: true,
/*
* Custom URL to show upon failure
*/
helpUrl:
'https://github.com/conventional-changelog/commitlint/#what-is-commitlint',
/*
* Custom prompt configs
*/
prompt: {
messages: {},
questions: {
type: {
description: 'please input type:',
},
},
},
};
module.exports = Configuration;
|
Hey, could you both please try with this tag and see if that sorts the issue? |
Works for me with: - repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook
rev: esm # This is a workaround for https://github.com/alessandrojcm/commitlint-pre-commit-hook/issues/152
hooks:
- id: commitlint
stages:
- commit-msg
additional_dependencies:
- '@commitlint/config-conventional' |
Works for me too.
|
Wow, I was going to pop in here to let you know version pinning the config dependency, such as |
Great I'll see about mergin it into master, it should be fine since ESM is supposed to be able to import CJS but weird things tend to happen. |
Just verified against 46ad8d1, works without any problems. Looking forward to the release. Thanks for your work @alessandrojcm! |
Released on v9.13.0 |
Installing with the following
.pre-commit-config.yaml
fails with an error.The error, with home path anonymized with $HOME:
Our
commitlint.config.js
:The text was updated successfully, but these errors were encountered: