Skip to content

Commit 552dbcf

Browse files
committed
chore: code review
1 parent 65769e9 commit 552dbcf

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

@commitlint/prompt/src/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import inquirer from 'inquirer';
2-
import input from './input';
2+
import {input} from './input';
33

44
type Commit = (input: string) => void;
55

@commitlint/prompt/src/input.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import {Answers, PromptModule, QuestionCollection} from 'inquirer';
22
/// <reference path="./inquirer/inquirer.d.ts" />
3-
import input from './input';
3+
import {input} from './input';
44
import chalk from 'chalk';
55

66
jest.mock(

@commitlint/prompt/src/input.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {DistinctQuestion, PromptModule} from 'inquirer';
44
import format from './library/format';
55
import getPrompt from './library/get-prompt';
66
import settings from './settings';
7-
import {InputSetting, Result} from './library/types';
7+
import type {InputSetting, Result} from './library/types';
88

99
import {getHasName, getMaxLength, getRules} from './library/utils';
1010
import InputCustomPrompt from './inquirer/InputCustomPrompt';
@@ -15,7 +15,7 @@ import InputCustomPrompt from './inquirer/InputCustomPrompt';
1515
* @param prompter
1616
* @return commit message
1717
*/
18-
export default async function input(prompter: PromptModule): Promise<string> {
18+
export async function input(prompter: PromptModule): Promise<string> {
1919
const {rules} = await load();
2020
const parts = ['type', 'scope', 'subject', 'body', 'footer'] as const;
2121
const headerParts = ['type', 'scope', 'subject'];
@@ -30,14 +30,14 @@ export default async function input(prompter: PromptModule): Promise<string> {
3030
prompter.registerPrompt('input-custom', InputCustomPrompt);
3131

3232
for (const input of parts) {
33-
const inputSettings: InputSetting = settings[input];
33+
const inputSetting: InputSetting = settings[input];
3434
const inputRules = getRules(input, rules);
3535
if (headerParts.includes(input) && maxLength < Infinity) {
36-
inputSettings.header = {
36+
inputSetting.header = {
3737
length: maxLength,
3838
};
3939
}
40-
const question = getPrompt(input, inputRules, inputSettings);
40+
const question = getPrompt(input, inputRules, inputSetting);
4141
if (question) {
4242
questions.push(question);
4343
}

0 commit comments

Comments
 (0)