Open
Description
Expected Behavior
Currently, it seems that plugins can only be resolved if they're an npm package inside of the node_modules folder (node resolution logic). If I try to load a plugin using a relative path, I get this error:
Error: Failed to load plugin ./plugins/my-custom-plugin.js: Cannot find module 'commitlint-plugin-./plugins/my-custom-plugin.js'
Relative paths are supported for the extends
and parserPreset
keys, so making this work would align that behavior with plugins
too.
Current Behavior
I would love to be able to write this and just have it work.
{
plugins: ['./dir/my-custom-plugin.js'],
...
}
Affected packages
- cli
- core
- prompt
- config-angular
Possible Solution
Looking at how the parserPreset key is being loaded, it seems like it's just a matter of using resolveFrom
before require
ing the plugin.
Context
I basically want to have a small custom rule in a single file, but it seems like a hassle to either handle two separate packages or set up lerna or something.
Your Environment
Executable | Version |
---|---|
commitlint --version |
8.2.0 |
git --version |
git version 2.23.0 |
node --version |
v12.10.0 |