Skip to content

Commit 72797a8

Browse files
committed
style: lint all files
1 parent d3c9aa4 commit 72797a8

File tree

9 files changed

+39
-39
lines changed

9 files changed

+39
-39
lines changed

src/engine.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ import { commitTemplate } from './commit-template';
1313
function buildQuestions(rules: QualifiedRules) {
1414
const combinedQuestions = pipeWith<Question[]>(
1515
[],
16-
(x) => typeMaker(x, rules),
17-
(x) => scopeMaker(x, rules),
18-
(x) => subjectMaker(x, rules),
19-
(x) => bodyMaker(x, rules),
20-
(x) => footerMaker(x, rules)
16+
x => typeMaker(x, rules),
17+
x => scopeMaker(x, rules),
18+
x => subjectMaker(x, rules),
19+
x => bodyMaker(x, rules),
20+
x => footerMaker(x, rules)
2121
);
2222

2323
return combinedQuestions;

src/prompts/body-maker.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ export function validatorFactory(rules: QualifiedRules): (value: string) => stri
1111
value,
1212
rule: rules['body-max-length'],
1313
validator: maxLengthValidator,
14-
message: (length) => `Body maximum length of ${length} has been exceeded`,
14+
message: length => `Body maximum length of ${length} has been exceeded`,
1515
},
1616
{
1717
value,
1818
rule: rules['body-min-length'],
1919
validator: minLengthValidator,
20-
message: (length) => `Body minimum length of ${length} has not been met`,
20+
message: length => `Body minimum length of ${length} has not been met`,
2121
},
2222
]);
2323
}
@@ -26,9 +26,9 @@ export function filterFactory(rules: QualifiedRules): (value: string) => string
2626
return (value: string) =>
2727
pipeWith<string>(
2828
value,
29-
(v) => maxLineLengthFilter(v, rules['body-max-line-length']),
30-
(v) => leadingBlankFilter(v, rules['body-leading-blank']),
31-
(v) => v.replace(/\\n/g, '\n')
29+
v => maxLineLengthFilter(v, rules['body-max-line-length']),
30+
v => leadingBlankFilter(v, rules['body-leading-blank']),
31+
v => v.replace(/\\n/g, '\n')
3232
);
3333
}
3434

@@ -40,8 +40,8 @@ export function transformerFactory(rules: QualifiedRules): (value: string) => st
4040
return (value: string) => {
4141
return pipeWith(
4242
value,
43-
(v) => v.replace(/\\n/g, '\n'),
44-
(v) => maxLenTransformer(v)
43+
v => v.replace(/\\n/g, '\n'),
44+
v => maxLenTransformer(v)
4545
);
4646
};
4747
}

src/prompts/footer-maker.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ export function validatorFactory(rules: QualifiedRules): (value: string, answers
1515
value: value + breaking,
1616
rule: rules['footer-max-length'],
1717
validator: maxLengthValidator,
18-
message: (length) => `Footer maximum length of ${length} has been exceeded`,
18+
message: length => `Footer maximum length of ${length} has been exceeded`,
1919
},
2020
{
2121
value: value + breaking,
2222
rule: rules['footer-min-length'],
2323
validator: minLengthValidator,
24-
message: (length) => `Footer minimum length of ${length} has not been met`,
24+
message: length => `Footer minimum length of ${length} has not been met`,
2525
},
2626
]);
2727
};
@@ -31,9 +31,9 @@ export function filterFactory(rules: QualifiedRules, prefix = '') {
3131
return (value: string): string =>
3232
pipeWith<string>(
3333
value,
34-
(v) => prefix + v,
35-
(v) => leadingBlankFilter(v, rules['footer-leading-blank']),
36-
(v) => maxLineLengthFilter(v, rules['footer-max-line-length'])
34+
v => prefix + v,
35+
v => leadingBlankFilter(v, rules['footer-leading-blank']),
36+
v => maxLineLengthFilter(v, rules['footer-max-line-length'])
3737
);
3838
}
3939

@@ -105,7 +105,7 @@ export function footerMaker(questions: Question[], rules: QualifiedRules): Quest
105105
type: 'input',
106106
name: 'breaking',
107107
message: breakingChangeMessageFactory(rules),
108-
when: (answers) => !!answers.isBreaking,
108+
when: answers => !!answers.isBreaking,
109109
validate: validatorFactory(rules),
110110
transformer: breakingTransformFactory(rules, BREAKING_CHANGE),
111111
filter: filterFactory(rules, BREAKING_CHANGE),
@@ -114,14 +114,14 @@ export function footerMaker(questions: Question[], rules: QualifiedRules): Quest
114114
type: 'confirm',
115115
name: 'isIssue',
116116
message: 'Does this fix Does this change affect any open issues?',
117-
when: (answers) => !isFixCommit(answers),
117+
when: answers => !isFixCommit(answers),
118118
default: false,
119119
},
120120
{
121121
type: 'input',
122122
name: 'issue',
123123
message: issuesMessageFactory(rules),
124-
when: (answers) => isFixCommit(answers) || !!answers.isIssue,
124+
when: answers => isFixCommit(answers) || !!answers.isIssue,
125125
validate: validatorFactory(rules),
126126
transformer: issuesTransformerFactory(rules),
127127
filter: filterFactory(rules),

src/prompts/scope-maker.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ export function validatorFactory(rules: QualifiedRules): (value: string) => stri
1313
value,
1414
rule: rules['scope-max-length'],
1515
validator: maxLengthValidator,
16-
message: (length) => `Scope maximum length of ${length} has been exceeded`,
16+
message: length => `Scope maximum length of ${length} has been exceeded`,
1717
},
1818
{
1919
value,
2020
rule: rules['scope-min-length'],
2121
validator: minLengthValidator,
22-
message: (length) => `Scope minimum length of ${length} has not been met`,
22+
message: length => `Scope minimum length of ${length} has not been met`,
2323
},
2424
{
2525
value,
@@ -54,7 +54,7 @@ function parseEmptyScopeRule(rule: QualifiedRules['scope-empty']): [boolean, Cho
5454
function parseScopeEnumRule(rule: QualifiedRules['scope-enum']): [boolean, ChoiceOptions[] | undefined] {
5555
if (rule !== undefined) {
5656
const [, , scopeEnum] = rule;
57-
return [true, (scopeEnum ?? []).map((scope) => ({ name: scope, value: scope }))];
57+
return [true, (scopeEnum ?? []).map(scope => ({ name: scope, value: scope }))];
5858
}
5959
return [false, undefined];
6060
}

src/prompts/subject-maker.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,19 @@ export function validatorFactory(rules: QualifiedRules): (value: string, answers
1414
value: headerValue,
1515
rule: rules['header-max-length'],
1616
validator: maxLengthValidator,
17-
message: (length) => `Header "${headerValue}" cannot be longer than ${length}`,
17+
message: length => `Header "${headerValue}" cannot be longer than ${length}`,
1818
},
1919
{
2020
value,
2121
rule: rules['subject-max-length'],
2222
validator: maxLengthValidator,
23-
message: (length) => `Subject maximum length of ${length} has been exceeded`,
23+
message: length => `Subject maximum length of ${length} has been exceeded`,
2424
},
2525
{
2626
value,
2727
rule: rules['subject-min-length'],
2828
validator: minLengthValidator,
29-
message: (length) => `Subject minimum length of ${length} has not been met`,
29+
message: length => `Subject minimum length of ${length} has not been met`,
3030
},
3131
{
3232
value,
@@ -48,8 +48,8 @@ export function filterFactory(rules: QualifiedRules): (value: string) => string
4848
return (value: string) =>
4949
pipeWith<string>(
5050
value,
51-
(v) => wordCaseFilter(v, rules['subject-case']),
52-
(v) => fullStopFilter(v, rules['subject-full-stop'])
51+
v => wordCaseFilter(v, rules['subject-case']),
52+
v => fullStopFilter(v, rules['subject-full-stop'])
5353
);
5454
}
5555

src/prompts/type-maker.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ export function validatorFactory(rules: QualifiedRules): (value: string) => stri
1414
value,
1515
rule: rules['type-max-length'],
1616
validator: maxLengthValidator,
17-
message: (length) => `Type maximum length of ${length} has been exceeded`,
17+
message: length => `Type maximum length of ${length} has been exceeded`,
1818
},
1919
{
2020
value,
2121
rule: rules['type-min-length'],
2222
validator: minLengthValidator,
23-
message: (length) => `Type minimum length of ${length} has not been met`,
23+
message: length => `Type minimum length of ${length} has not been met`,
2424
},
2525
{
2626
value,
@@ -57,7 +57,7 @@ export function choicesFactory(
5757
let choices: ChoiceOptions[] | undefined;
5858
if (typeEnum && typeEnum.length > 0) {
5959
const longest = getLongest(typeEnum);
60-
choices = typeEnum.map((value) => ({
60+
choices = typeEnum.map(value => ({
6161
name: `${value.padEnd(longest)}: ${commitTypes[value]?.description ?? ''}`,
6262
value: value,
6363
short: value,
@@ -66,7 +66,7 @@ export function choicesFactory(
6666

6767
return (
6868
choices ||
69-
Object.keys(commitTypes).map((commitType) => ({
69+
Object.keys(commitTypes).map(commitType => ({
7070
name: `${commitType}: ${commitTypes[commitType].description ?? ''}`,
7171
value: commitType,
7272
short: commitType,

src/utils.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ describe('utils', () => {
1414

1515
describe('pipeWith', () => {
1616
test('pipes value to function', () => {
17-
const result = pipeWith('hello ', (x) => (x += 'world'));
17+
const result = pipeWith('hello ', x => (x += 'world'));
1818

1919
expect(result).toBe('hello world');
2020
});

src/validators.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ describe('validators', () => {
100100
value: 'foo',
101101
rule: [RuleConfigSeverity.Error, 'never', 72],
102102
validator: () => true,
103-
message: (ruleValue) => `error ${ruleValue}`,
103+
message: ruleValue => `error ${ruleValue}`,
104104
},
105105
]);
106106

src/validators.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export function validate(
1616
}[]
1717
): string | true {
1818
const errorMessages: string[] = validators
19-
.map((v) => {
19+
.map(v => {
2020
if (v.rule === undefined) {
2121
return true;
2222
}
@@ -44,7 +44,7 @@ export function validate(
4444

4545
return true;
4646
})
47-
.filter((message) => message !== true) as string[];
47+
.filter(message => message !== true) as string[];
4848

4949
if (errorMessages.length === 0) {
5050
return true;
@@ -58,7 +58,7 @@ export function maxLengthValidator(value: string, length: number): boolean {
5858
}
5959

6060
export function maxLineLengthValidator(value: string, length: number): boolean {
61-
return value.split(/\r?\n/).every((line) => maxLengthValidator(line, length));
61+
return value.split(/\r?\n/).every(line => maxLengthValidator(line, length));
6262
}
6363

6464
export function minLengthValidator(value: string, length: number): boolean {
@@ -75,8 +75,8 @@ export function caseValidator(value: string, rule: TargetCaseType | TargetCaseTy
7575
}
7676

7777
if (inclusive) {
78-
return rule.every((r) => wordCase(value, r) === value);
78+
return rule.every(r => wordCase(value, r) === value);
7979
}
8080

81-
return rule.some((r) => wordCase(value, r) === value);
81+
return rule.some(r => wordCase(value, r) === value);
8282
}

0 commit comments

Comments
 (0)