Closed
Description
Expected Behavior
In a typescript project, provide an asynchronous list for the scope-enum rule, as described in the doc https://github.com/conventional-changelog/commitlint/blob/master/docs/reference-rules.md
Current Behavior
Typescript complains of a type mismatch and the code is not compiled
Affected packages
- types
Possible Solution
I don't think the QualifiedConfig type is correct for the async option. It should probably be (() => Promise<RuleConfigTuple<T>>)
instead.
Steps to Reproduce (for bugs)
- Try to compile the typescript configuration provided to javascript with
tsc
commitlint.config.ts
import type { RulesConfig } from '@commitlint/types';
import { RuleConfigSeverity } from '@commitlint/types';
const { Error } = RuleConfigSeverity;
export const rules: Partial<RulesConfig> = {
'scope-enum': () => Promise.resolve([Error, 'always', ['one', 'two', 'three']]),
};
export default {
rules,
};
Context
I want to restrict commit scopes to a predefined list that cannot be defined synchronously. I have to define a custom rule/plugin to work around this issue.
Your Environment
Executable | Version |
---|---|
commitlint --version |
14.1.0 |
git --version |
V2.33.1 |
node --version |
v16.12.0 |
Metadata
Metadata
Assignees
Labels
No labels