commitlint icon indicating copy to clipboard operation
commitlint copied to clipboard

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

Open marcalexiei opened this issue 1 year ago • 8 comments

Expected Behavior

See context

Current Behavior

See context

Affected packages

  • [ ] cli
  • [X] 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 (https://github.com/conventional-changelog/commitlint/pull/3871), a certain amount of user has reported issues when updating commitlint:

  1. https://github.com/conventional-changelog/commitlint/pull/3871#issuecomment-1911312089
  2. https://github.com/conventional-changelog/commitlint/pull/3871#issuecomment-1916336429
  3. https://github.com/conventional-changelog/commitlint/pull/3871#issuecomment-1917735604

For reference:

Explanation of the cause of the error

The error is thrown here:

https://github.com/conventional-changelog/commitlint/blob/daa8b1baa8732b3f1f937d2453608d47b4952bff/%40commitlint/lint/src/lint.ts#L78-L86

all rules is declared reading the content of baseRules:

https://github.com/conventional-changelog/commitlint/blob/daa8b1baa8732b3f1f937d2453608d47b4952bff/%40commitlint/lint/src/lint.ts#L59-L62

baseRules are imported from @commitlint-rules:

https://github.com/conventional-changelog/commitlint/blob/daa8b1baa8732b3f1f937d2453608d47b4952bff/%40commitlint/lint/src/lint.ts#L4

in version 14.6.0 header-trim definition has been added

https://github.com/conventional-changelog/commitlint/blob/daa8b1baa8732b3f1f937d2453608d47b4952bff/%40commitlint/rules/src/index.ts#L55


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 https://github.com/conventional-changelog/commitlint/issues/3871#issuecomment-1911455325

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 https://github.com/conventional-changelog/commitlint/issues/3871#issuecomment-1914327791

marcalexiei avatar Feb 03 '24 16:02 marcalexiei

@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.

marcalexiei avatar Feb 04 '24 16:02 marcalexiei

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.

escapedcat avatar Feb 06 '24 15:02 escapedcat

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

dangreen avatar Feb 06 '24 15:02 dangreen

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 avatar Feb 06 '24 15:02 escapedcat

@escapedcat I contacted with @bcoe via email.

dangreen avatar Feb 06 '24 17:02 dangreen

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.

knocte avatar Feb 10 '24 05:02 knocte

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: https://github.com/tamasfe/taplo/issues/403#issuecomment-1828235877 and I'm trust from the original author at https://github.com/tamasfe/taplo/issues/403#issuecomment-1913342635. So that I could finally finish the blocking PR https://github.com/tamasfe/taplo/pull/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.

JounQin avatar Feb 11 '24 17:02 JounQin

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.

escapedcat avatar Feb 12 '24 08:02 escapedcat