Description
Expected Behavior
I'd expect it to load the plugin as it did previously. I'm not sure what changed between now and 'previously', whether that is node/npm version or something else.
Current Behavior
Loading a plugin of a configuration fails.
Edit: It the plugin is found as expected when I install @commitlint/cli@11.0.0
instead of 12.0.0 or 12.0.1, so it seems to me this bug was introduced in 12.0.0. The two suspects in that release, based on the changelog would IMO be #2070 and #982, where the former is IMHO most likely.
Affected packages
- cli
- core
- prompt
- config-angular
Possible Solution
What works, but is very undesired, is installing the plugin manually as user of my configuration.
Steps to Reproduce (for bugs)
- Create an empty workspace
mkdir test && cd test
- Install
@commitlint/cli
and@vidavidorra/commitlint-config
npm i -D @commitlint/cli@12.0.1 @vidavidorra/commitlint-config@2.1.13
- Create a configuration
echo "module.exports = { extends: ['@vidavidorra/commitlint-config'] };" > commitlint.config.js
- Test a commit message
$ echo 'test (fail)' | npx --no-install commitlint Failed to load plugin commitlint-plugin-function-rules. /home/jdebruijn/projects/node_modules/@commitlint/cli/lib/cli.js:106 throw err; ^ MissingPluginError: Failed to load plugin function-rules: Cannot find module 'commitlint-plugin-function-rules' Require stack: - /home/jdebruijn/projects/node_modules/@commitlint/load/lib/utils/load-plugin.js - /home/jdebruijn/projects/node_modules/@commitlint/load/lib/load.js - /home/jdebruijn/projects/node_modules/@commitlint/cli/lib/cli.js - /home/jdebruijn/projects/node_modules/@commitlint/cli/cli.js at Object.loadPlugin [as default] (/home/jdebruijn/projects/node_modules/@commitlint/load/lib/utils/load-plugin.js:32:23) at /home/jdebruijn/projects/node_modules/@commitlint/load/lib/load.js:66:38 at Array.forEach (<anonymous>) at Object.load [as default] (/home/jdebruijn/projects/node_modules/@commitlint/load/lib/load.js:64:24) at processTicksAndRejections (node:internal/process/task_queues:94:5) at async main (/home/jdebruijn/projects/node_modules/@commitlint/cli/lib/cli.js:140:20) { messageTemplate: 'plugin-missing', messageData: { pluginName: 'commitlint-plugin-function-rules', commitlintPath: '/home/jdebruijn/projects/node_modules/@commitlint/load' } }
commitlint.config.js
module.exports = {
extends: ['@vidavidorra/commitlint-config'],
};
Context
I have a shared configuration, @vidavidorra/commitlint-config
, which uses a plugin, commitlint-plugin-function-rules
as plugin. In my configuration I have the plugin as npm dependency. In my configuration I use this plugin to create certain rules. Users of my configuration get an error about the plugin of my configuration not being found, where users only install @vidavidorra/commitlint-config
and not its dependencies, which they shouldn't need to care about.
Your Environment
Executable | Version |
---|---|
commitlint --version |
12.0.1 |
git --version |
2.30.1 |
node --version |
15.10.0 |