Skip to content

Commit 95ae62b

Browse files
committed
Updating the default rule configuration to use the new rules added.
1 parent 6db7138 commit 95ae62b

File tree

2 files changed

+36
-4
lines changed

2 files changed

+36
-4
lines changed

packages/commitlint-config-github/@types/index.d.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
type RuleConfig = [number, string?, (boolean | number | string | string[])?];
2+
13
export interface CommitlintConfigGitHub {
24
rules: {
3-
[key: string]: number | (number | string | boolean)[];
5+
[key: string]: RuleConfig;
46
};
57
}
68
declare const commitlintConfigGitHub: CommitlintConfigGitHub;

packages/commitlint-config-github/src/index.ts

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,40 @@
1-
import { commitlintGitHubConstants } from 'commitlint-github-utils';
1+
import { When } from 'commitlint-github-utils/@types';
2+
import utils from 'commitlint-github-utils';
23
import { CommitlintConfigGitHub } from '../@types';
34

5+
const commitlintGitHubRules = utils.commitlintGitHubConstants.GITHUB_RULES;
6+
7+
const supportedTypes = [
8+
'build',
9+
'chore',
10+
'ci',
11+
'docs',
12+
'feat',
13+
'feature', // Additional one for those who prefer a full word
14+
'fix',
15+
'improvement',
16+
'perf',
17+
'refactor',
18+
'revert',
19+
'style',
20+
'test',
21+
];
22+
423
export const commitlintConfigGitHub: CommitlintConfigGitHub = {
524
rules: {
6-
[commitlintGitHubConstants.GITHUB_RULES.issueNumberMissing]: [2, 'always', true],
7-
[commitlintGitHubConstants.GITHUB_RULES.issueNumberFormat]: [2, 'always'],
25+
[commitlintGitHubRules.issueNumberMissing]: [2, When.NEVER],
26+
[commitlintGitHubRules.issueNumberFormat]: [2, When.ALWAYS],
27+
[commitlintGitHubRules.issueNumberDuplicate]: [2, When.NEVER],
28+
29+
[commitlintGitHubRules.wipAllowed]: [2, When.ALWAYS],
30+
31+
[commitlintGitHubRules.subjectEmpty]: [2, When.NEVER],
32+
[commitlintGitHubRules.subjectSeparator]: [2, When.ALWAYS],
33+
[commitlintGitHubRules.subjectCase]: [2, When.ALWAYS, 'sentence-case'],
34+
[commitlintGitHubRules.subjectFullStop]: [1, When.ALWAYS], // Warning only
35+
36+
[commitlintGitHubRules.typeCase]: [2, When.ALWAYS, 'lower-case'],
37+
[commitlintGitHubRules.typeEnum]: [2, When.ALWAYS, supportedTypes],
838
},
939
};
1040

0 commit comments

Comments
 (0)