A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/conventional-changelog/commitlint/issues/2868 below:

Can't use async rule configuration · Issue #2868 · conventional-changelog/commitlint · GitHub

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 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)
  1. 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

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