conventional-changelog / commitlint

📓 Lint commit messages

Home Page:https://commitlint.js.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

feat: how to mitigate errors when adding a new rule and not updating all relevant packages

marcalexiei opened this issue · comments

Expected Behavior

See context

Current Behavior

See context

Affected packages

  • cli
  • core
  • prompt
  • config-angular

Possible Solution

  1. Adding a "troubleshooting" section in the docs explaining the reason of the issue and how to resolve it.
  2. Integrate RangeError: Found invalid rule names with an additional description providing the user a clue that some @commitlint/packages should be updated (a link to the new documentation section could do the trick).

What do you think? If you agree I can work on a PR.

Context

After adding header-trim rule (#3871),
a certain amount of user has reported issues when updating commitlint:

  1. #3871 (comment)
  2. #3871 (comment)
  3. #3871 (comment)

For reference:

Explanation of the cause of the error

The error is thrown here:

if (missing.length > 0) {
const names = [...allRules.keys()];
throw new RangeError(
`Found invalid rule names: ${missing.join(
', '
)}. Supported rule names are: ${names.join(', ')}`
);
}

all rules is declared reading the content of baseRules:

const allRules: Map<string, BaseRule<never, RuleType>> = new Map(
Object.entries(defaultRules)
);

baseRules are imported from @commitlint-rules:

import defaultRules from '@commitlint/rules';

in version 14.6.0 header-trim definition has been added

'header-trim': headerTrim,


Running command line from CLI doesn't throw any error.
If I have to make a guess not all required packages have updated to version 18.6.0.

Originally posted by @marcalexiei in #3871 (comment)

Solution

[!WARNING]
The source of this error is likely a mismatch of version between @commitlint packages in node_modules

Detailed explanation can be found in a comment above.

If someone is relying on a config which depends on an earlier version of @commitlint/config-conventional be sure to update it:

npm update @commitlint/config-conventional

Originally posted by @marcalexiei in #3871 (comment)

@escapedcat in order to avoid conflicts with ESM migration I'll wait merge of #3850 before working on a proposal.

Also, if agree and there is a spot available, I would like to join conventional-changelog / commitlint team.

Also, if agree and there is a spot available, I would like to join conventional-changelog / commitlint team.

tbh I'm not sure how to do this. Can tag /cc @dangreen , maybe he knows.

I don't have rights to add new members to organization. I'm not organization owner.

I don't have rights to add new members to organization. I'm not organization owner.

Sure, but do you know who to contact? Who added you? I was added by Mario but he's isn't available anymore.

@escapedcat I contacted with @bcoe via email.

Sure, but do you know who to contact? Who added you? I was added by Mario

Hey guys, not to be the party-wrecker here, but isn't it a bit early?
I mean, maintainership is usually given to contributors that have many contributions to a project, not just 4. And it also usually offered to someone, not requested by someone (the only cases where I found the latter is done is when the project is kinda dying and someone steps up to save it from becoming irrelevant). Mind you, this is not envy or anything because, despite having more contributions myself (and more than double if I count the contributions of my team) I don't want to be maintainer myself, as I'm already at the helm of 2 or 3 projects, so I have too much on my plate.

With this I hope I'm not deterring Marc from making more great contributions. I just think that in general, maintainership is earned, not requested&granted.

I respectfully disagree with @knocte.

I'm involved in OSS a lot, and here is a true example that a I volunteer and request to be maintainer first: tamasfe/taplo#403 (comment) and I'm trust from the original author at tamasfe/taplo#403 (comment). So that I could finally finish the blocking PR tamasfe/taplo#502

What I want to say is, we as volunteers, should be allowed to apply for membership so that we can make more valuable contributions. It's a honor yet responsibility.

Let's maybe stop here with this off-topic discussion?
Unfortunately we do not have a chat currently but you could create a new issue to discuss things further.

My 2 cents are that I'm happy if people start trying to get into the org on their own initiative.
So far we invited to join the commitlint "team" after activity over a longer period of time. Some joined, some refused.