We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8a8384f commit c7f355bCopy full SHA for c7f355b
@commitlint/load/src/load.test.ts
@@ -33,6 +33,22 @@ test('uses seed as configured', async () => {
33
expect(actual.rules['body-case']).toStrictEqual([1, 'never', 'camel-case']);
34
});
35
36
+test('rules should be loaded from local', async () => {
37
+ const actual = await load({
38
+ rules: {
39
+ direct: [1, 'never', 'foo'],
40
+ func: () => [1, 'never', 'foo'],
41
+ async: async () => [1, 'never', 'foo'],
42
+ promise: () => Promise.resolve([1, 'never', 'foo']),
43
+ },
44
+ });
45
+
46
+ expect(actual.rules['direct']).toStrictEqual([1, 'never', 'foo']);
47
+ expect(actual.rules['func']).toStrictEqual([1, 'never', 'foo']);
48
+ expect(actual.rules['async']).toStrictEqual([1, 'never', 'foo']);
49
+ expect(actual.rules['promise']).toStrictEqual([1, 'never', 'foo']);
50
+});
51
52
test('rules should be loaded from relative config file', async () => {
53
const file = 'config/commitlint.config.js';
54
const cwd = await gitBootstrap('fixtures/specify-config-file');
@commitlint/types/src/rules.ts
@@ -65,7 +65,7 @@ export enum RuleConfigQuality {
65
66
export type QualifiedRuleConfig<T> =
67
| (() => RuleConfigTuple<T>)
68
- | (() => RuleConfigTuple<Promise<T>>)
+ | (() => Promise<RuleConfigTuple<T>>)
69
| RuleConfigTuple<T>;
70
71
export type RuleConfig<
0 commit comments