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 BehaviorTypescript complains of a type mismatch and the code is not compiled
Affected packagesI don't think the QualifiedConfig type is correct for the async option. It should probably be (() => Promise<RuleConfigTuple<T>>)
instead.
tsc
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 Versioncommitlint --version
14.1.0 git --version
V2.33.1 node --version
v16.12.0
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4