1
- import { TargetCaseType } from './ensure' ;
2
- import { Rule , RuleCondition } from './rules' ;
1
+ import { Rule , RulesConfig , RuleConfigQuality } from './rules' ;
3
2
4
3
export type PluginRecords = Record < string , Plugin > ;
5
4
@@ -14,84 +13,9 @@ export interface LoadOptions {
14
13
file ?: string ;
15
14
}
16
15
17
- export enum RuleSeverity {
18
- Disabled = 0 ,
19
- Warning = 1 ,
20
- Error = 2
21
- }
22
-
23
- export type RuleConfigTuple < T > = T extends void
24
- ? Readonly < [ RuleSeverity , RuleCondition ] >
25
- : Readonly < [ RuleSeverity , RuleCondition , T ] > ;
26
-
27
- export enum RuleConfigQuality {
28
- User ,
29
- Qualified
30
- }
31
-
32
- export type QualifiedRuleConfig < T > =
33
- | ( ( ) => RuleConfigTuple < T > )
34
- | ( ( ) => RuleConfigTuple < Promise < T > > )
35
- | RuleConfigTuple < T > ;
36
-
37
- export type RuleConfig <
38
- V = RuleConfigQuality . Qualified ,
39
- T = void
40
- > = V extends RuleConfigQuality . Qualified
41
- ? RuleConfigTuple < T >
42
- : QualifiedRuleConfig < T > ;
43
-
44
- export type CaseRuleConfig < V = RuleConfigQuality . User > = RuleConfig <
45
- V ,
46
- TargetCaseType
47
- > ;
48
- export type LengthRuleConfig < V = RuleConfigQuality . User > = RuleConfig <
49
- V ,
50
- number
51
- > ;
52
- export type EnumRuleConfig < V = RuleConfigQuality . User > = RuleConfig <
53
- V ,
54
- string [ ]
55
- > ;
56
-
57
- export type RulesConfig < V = RuleConfigQuality . User > = {
58
- 'body-case' : CaseRuleConfig < V > ;
59
- 'body-empty' : RuleConfig < V > ;
60
- 'body-leading-blank' : RuleConfig < V > ;
61
- 'body-max-length' : LengthRuleConfig < V > ;
62
- 'body-max-line-length' : LengthRuleConfig < V > ;
63
- 'body-min-length' : LengthRuleConfig < V > ;
64
- 'footer-empty' : RuleConfig < V > ;
65
- 'footer-leading-blank' : RuleConfig < V > ;
66
- 'footer-max-length' : LengthRuleConfig < V > ;
67
- 'footer-max-line-length' : LengthRuleConfig < V > ;
68
- 'footer-min-length' : LengthRuleConfig < V > ;
69
- 'header-case' : CaseRuleConfig < V > ;
70
- 'header-full-stop' : RuleConfig < V > ;
71
- 'header-max-length' : LengthRuleConfig < V > ;
72
- 'header-min-length' : LengthRuleConfig < V > ;
73
- 'references-empty' : RuleConfig < V > ;
74
- 'scope-case' : CaseRuleConfig < V > ;
75
- 'scope-empty' : RuleConfig < V > ;
76
- 'scope-enum' : EnumRuleConfig < V > ;
77
- 'scope-max-length' : LengthRuleConfig < V > ;
78
- 'scope-min-length' : LengthRuleConfig < V > ;
79
- 'signed-off-by' : RuleConfig < V > ;
80
- 'subject-case' : CaseRuleConfig < V > ;
81
- 'subject-empty' : RuleConfig < V > ;
82
- 'subject-full-stop' : RuleConfig < V > ;
83
- 'subject-max-length' : LengthRuleConfig < V > ;
84
- 'subject-min-length' : LengthRuleConfig < V > ;
85
- 'type-case' : CaseRuleConfig < V > ;
86
- 'type-empty' : RuleConfig < V > ;
87
- 'type-enum' : EnumRuleConfig < V > ;
88
- 'type-max-length' : LengthRuleConfig < V > ;
89
- 'type-min-length' : LengthRuleConfig < V > ;
90
- } ;
91
-
92
16
export interface UserConfig {
93
17
extends ?: string [ ] ;
94
- formatter ?: unknown ;
18
+ formatter ?: string ;
95
19
rules ?: Partial < RulesConfig > ;
96
20
parserPreset ?: string | ParserPreset ;
97
21
ignores ?: ( ( commit : string ) => boolean ) [ ] ;
@@ -101,7 +25,7 @@ export interface UserConfig {
101
25
102
26
export interface UserPreset {
103
27
extends ?: string [ ] ;
104
- formatter ?: unknown ;
28
+ formatter ?: string ;
105
29
rules ?: Partial < RulesConfig > ;
106
30
parserPreset ?: string | ParserPreset ;
107
31
ignores ?: ( ( commit : string ) => boolean ) [ ] ;
@@ -113,7 +37,7 @@ export type QualifiedRules = Partial<RulesConfig<RuleConfigQuality.Qualified>>;
113
37
114
38
export interface QualifiedConfig {
115
39
extends : string [ ] ;
116
- formatter : unknown ;
40
+ formatter : string ;
117
41
rules : QualifiedRules ;
118
42
parserPreset : ParserPreset ;
119
43
ignores : ( ( commit : string ) => boolean ) [ ] ;
0 commit comments