Open
Description
Expected Behavior
The extends
property in commitlint.config.js
should resolve configs using es6-style default exports.
Current Behavior
Currently, commitlint
appears to only look at module.exports
as a whole, so if an exported config uses a es6-style default export like this:
Object.defineProperty(exports, "__esModule", { value: true });
var config = {/* rules, etc. */};
exports.default = config;
then presumably the config is resolved to something like:
{
default: {/* rules, etc. */
}
and commitlint
throws an error with: "Please add rules to your commitlint.config.js"
As a workaround we must do something like this in commitlint.config.js
:
const {default: config} = require('path/to/module');
module.exports = config
Affected packages
- cli
- core
- prompt
- config-angular
Possible Solution
I'm not familiar with the codebase; however, I think at minimum there needs to be a c.default || c
to unwrap the default
export if it's present. This should allow compatibility for the old module.exports = config
style and the new exports.default = config
style.
Steps to Reproduce (for bugs)
- First step
- Second step
commitlint.config.js
```js ```Context
Your Environment
Executable | Version |
---|---|
commitlint --version |
11.0.0 |
git --version |
2.27.0 |
node --version |
14.15.4 |