-
Notifications
You must be signed in to change notification settings - Fork 934
Enable "all"/* scopes in commit message #91
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
Comments
Currently there is no mechanism in place for passing configuration to shareable You could take advantage of the fact const {getPackages} = require('@commitlint/config-lerna-scopes').utils;
module.exports = {
extends: ['@commitlint/config-angular'],
rules: {
'scope-enum': () => [2, 'always', [...getPackages(), '*']]
}
}; For the time being I'd prefer documenting this as a pattern with We als should standardise this as optional API across all shareable config, will have to think about the best way to do that. |
Thanks for the advice! I did end up doing something similar. In case it's useful to anyone else: I'm using commitlint in combination with Commitizen. Originally I was using Commitizen's cz-conventional-changelog, but I wanted a few adjustments to that series of prompts. Thought about checking out commitlint's prompts, but tried out cz-customizable first due to having read an issue here that suggested commitlint wouldn't currently support a selection prompt for scopes (which I wanted), but knowing cz-customizable would. Then I came across commitlint-config-cz which will read from the same
|
Closing this, I think the current patterns suffice to cater this use case. |
I got it to work like this: const { getPackages } = require('@commitlint/config-lerna-scopes').utils
module.exports = {
extends: ['@commitlint/config-conventional'],
rules: {
'scope-enum': ctx => getPackages(ctx).then(packages => [2, 'always', ['all', ...packages]]),
},
} |
Along similar lines of https://github.com/marionebl/commitlint/issues/75 (especially in a multi-repo) I think it is useful to have a scope for "everything." For example, I am setting up commitlint in an early-stage Lerna multi-repo, which means making commits to add commitlint. I am not adding commitlint to specific packages, but rather to the project, so the change affects all the possible scopes supported by config-lerna-scopes.
I can obviously bypass validation for this type of commit in the meantime, but if that becomes a habit for the team, other types of errors could creep in unless we all ensure we run once to verify the output's only error is scope related. Just overall seems like a better experience to have a way to make these types of commits with accurate messages without getting an error (especially given the superfluous warnings I am also getting, mentioned in other issues).
I've seen some projects use
*
orall
, maybe config-lerna-scopes could add a valid scope along those lines or allow a configuration to define some additional valid scopes that don't directly map to module names?The text was updated successfully, but these errors were encountered: