After upgrading from Node 12.10 to 12.11 this morning, I began to get commits failing with an error being thrown (see below under "current behavior" for error - it looks like error message from ESM module loader).
Commit is successful, given an appropriately formatted message.
Works when I am using Node 12.10
Error is thrown when using Node 12.11.
Commit failed with error
0 files committed, 1 file failed to commit: docs(DIALOGUE-131): trivial change to test commitlint error
husky > commit-msg (node v12.11.0)
C:\Users\mbrant\git\customer-portal-server\node_modules\commitlint\node_modules\@commitlint\cli\lib\cli.js:119
throw err;
^
Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: C:\Users\mbrant\git\customer-portal-server\commitlint.config.js
at Object.Module._extensions..js (internal/modules/cjs/loader.js:958:13)
at Module.load (internal/modules/cjs/loader.js:798:32)
at Function.Module._load (internal/modules/cjs/loader.js:711:12)
at Module.require (internal/modules/cjs/loader.js:838:19)
at require (internal/modules/cjs/helpers.js:74:18)
at module.exports (C:\Users\mbrant\git\customer-portal-server\node_modules\cosmiconfig\node_modules\import-fresh\index.js:28:9)
at loadJs (C:\Users\mbrant\git\customer-portal-server\node_modules\cosmiconfig\dist\loaders.js:9:18)
at Explorer.loadFileContent (C:\Users\mbrant\git\customer-portal-server\node_...
Not sure... cli? core? Might actually be an issue with ESM
Unknown, but could possibly be issue with ESM module loader
When first encountering this issue today, I rolled back my commitlint version from 8.2.0 to 8.1.0 (as this was recently bumped in our repo) to see if this would fix, but the issue was experienced with that version as well.
Since I had just updated Node, I reverted from 12.11 back to 12.10 and the problem went away. I then re-installed Node 12.11 and the problem came back.
commitlint.config.js
module.exports = {
extends: ['@commitlint/config-conventional'],
// Disabling scope-case rule
rules: {
'scope-case': [0],
'scope-empty': [2, 'never'],
'subject-case': [0],
'subject-full-stop': [0]
}
};
Windows 10 Pro version 1803 ad git bash
| Executable | Version |
| ---: | :--- |
| commitlint --version | verified in 8.1.0 & 8.2.0 |
| git --version | 2.21.0.windows.1 |
| node --version | 12.11.0 fails, 12.10.0 works |
After upgrading to Node 13.0.1 (in conjunction with commitlint 8.2.0), I am no longer experiencing this issue. I did not test with Node >= 12.12 or 13.0.0.
git commit -m 'docs(DIALOGUE-131): trivial change to test commitlint error'
husky > commit-msg (node v12.11.1)
â§— input: docs(DIALOGUE-131): trivial change to test commitlint error
✖ scope must be lower-case [scope-case]
✖ found 1 problems, 0 warnings
ⓘ Get help: https://github.com/conventional-changelog/commitlint/#what-is-commitlint
./node_modules/.bin/commitlint -v
8.3.4
I guess this can be closed.
Most helpful comment
I guess this can be closed.