Skip to content

Commit fe54a84

Browse files
committed
IConfig: avoid "anonymous types"
For the `typia`-based validator, it is good to label each and every attribute's type so that the error messages are helpful. This commit is best viewed with `--ignore-space-change`. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1 parent f0bfeab commit fe54a84

1 file changed

Lines changed: 63 additions & 49 deletions

File tree

lib/project-config.ts

Lines changed: 63 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -8,57 +8,71 @@ export type projectInfo = {
88
urlPrefix: string; // url to 'listserv' of mail (should it be in mailrepo?)
99
};
1010

11+
export interface IRepoConfig {
12+
name: string; // name of the repo
13+
owner: string; // owner of repo holding the notes (tracking data)
14+
upstreamOwner: string; // owner of upstream ("base") repo
15+
testOwner?: string; // owner of the test repo (if any)
16+
branches: string[]; // remote branches to fetch - just use trackingBranches?
17+
closingBranches: string[]; // close if the pr is added to this branch
18+
trackingBranches: string[]; // comment if the pr is added to this branch
19+
maintainerBranch?: string; // branch/owner manually implementing changes
20+
host: string;
21+
}
22+
23+
export interface IMailRepoConfig {
24+
name: string;
25+
owner: string;
26+
branch: string;
27+
host: string;
28+
url: string;
29+
public_inbox_epoch?: number;
30+
mirrorURL?: string;
31+
mirrorRef?: string;
32+
descriptiveName: string;
33+
}
34+
35+
export interface IMailConfig {
36+
author: string;
37+
sender: string;
38+
smtpUser: string;
39+
smtpHost: string;
40+
}
41+
42+
export interface IAppConfig {
43+
appID: number;
44+
installationID: number;
45+
name: string;
46+
displayName: string; // name to use in comments to identify app
47+
installedOn: string[]; // owners of clones being monitored (PR checking)
48+
altname: string | undefined; // is this even needed?
49+
}
50+
51+
export interface ILintConfig {
52+
maxCommitsIgnore?: string[]; // array of pull request urls to skip check
53+
maxCommits: number; // limit on number of commits in a pull request
54+
}
55+
56+
export interface IUserConfig {
57+
allowUserAsLogin: boolean; // use GitHub login as name if name is private
58+
}
59+
60+
export interface ISyncUpstreamBranchesConfig {
61+
sourceRepo: string; // e.g. "gitster/git"
62+
targetRepo: string; // e.g. "gitgitgadget/git"
63+
sourceRefRegex?: string; // e.g. "^refs/heads/(maint-\\d|[a-z][a-z]/)"
64+
targetRefNamespace?: string; // e.g. "git-gui/"
65+
}
66+
1167
export interface IConfig {
12-
repo: {
13-
name: string; // name of the repo
14-
owner: string; // owner of repo holding the notes (tracking data)
15-
upstreamOwner: string; // owner of upstream ("base") repo
16-
testOwner?: string; // owner of the test repo (if any)
17-
branches: string[]; // remote branches to fetch - just use trackingBranches?
18-
closingBranches: string[]; // close if the pr is added to this branch
19-
trackingBranches: string[]; // comment if the pr is added to this branch
20-
maintainerBranch?: string; // branch/owner manually implementing changes
21-
host: string;
22-
};
23-
mailrepo: {
24-
name: string;
25-
owner: string;
26-
branch: string;
27-
host: string;
28-
url: string;
29-
public_inbox_epoch?: number;
30-
mirrorURL?: string;
31-
mirrorRef?: string;
32-
descriptiveName: string;
33-
};
34-
mail: {
35-
author: string;
36-
sender: string;
37-
smtpUser: string;
38-
smtpHost: string;
39-
};
68+
repo: IRepoConfig;
69+
mailrepo: IMailRepoConfig;
70+
mail: IMailConfig;
4071
project?: projectInfo | undefined; // project-options values
41-
app: {
42-
appID: number;
43-
installationID: number;
44-
name: string;
45-
displayName: string; // name to use in comments to identify app
46-
installedOn: string[]; // owners of clones being monitored (PR checking)
47-
altname: string | undefined; // is this even needed?
48-
};
49-
lint: {
50-
maxCommitsIgnore?: string[]; // array of pull request urls to skip check
51-
maxCommits: number; // limit on number of commits in a pull request
52-
};
53-
user: {
54-
allowUserAsLogin: boolean; // use GitHub login as name if name is private
55-
};
56-
syncUpstreamBranches: Array<{
57-
sourceRepo: string; // e.g. "gitster/git"
58-
targetRepo: string; // e.g. "gitgitgadget/git"
59-
sourceRefRegex?: string; // e.g. "^refs/heads/(maint-\\d|[a-z][a-z]/)"
60-
targetRefNamespace?: string; // e.g. "git-gui/"
61-
}>; // branches to sync from upstream to our repo
72+
app: IAppConfig;
73+
lint: ILintConfig;
74+
user: IUserConfig;
75+
syncUpstreamBranches: ISyncUpstreamBranchesConfig[]; // branches to sync from upstream to our repo
6276
}
6377

6478
let config: IConfig; // singleton

0 commit comments

Comments
 (0)