-
Notifications
You must be signed in to change notification settings - Fork 909
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
Failed to load plugin in configuration #2481
Comments
Well, it doesn't seems to be #2070. I've reverted the changes in |
Okay, so this is very strange. I honestly have no idea what is going on. 1-3 are when the plugin is found and I can normally run commitlint and 4-6 when the plugin is not found and commitlint fails.
|
It seems this issue comes up when a plugin uses a different commitlint version (major at least, not sure about whether minor and patch matter) then the configuration and/or user CLI. My plugin now uses the same version as my configuration and on commitlint CLI 12.0.0 runs as expected. With this and my previous findings in mind, I'd say the issue is how commitlint resolves plugins and/or configurations. Specifically it seems to depend on npm flattening the dependency tree, which I believe is not guaranteed to happen but I'm no expert. Perhaps someone with more experience can shed more light on this topic and issue? As I can easily make my plugin and config use the same version, this isn't much of an issue for me so I probably won't be diving deeper into this issue although I think my findings already show some detail and possibly the cause of the issue. Of course I'd still be happy to help provide more information or doing some tests/reproduction if needed. |
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/[email protected]
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
Possible Solution
What works, but is very undesired, is installing the plugin manually as user of my configuration.
Steps to Reproduce (for bugs)
mkdir test && cd test
@commitlint/cli
and@vidavidorra/commitlint-config
commitlint.config.js
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
commitlint --version
git --version
node --version
The text was updated successfully, but these errors were encountered: