Skip to content

Commit

Permalink
chore: code review
Browse files Browse the repository at this point in the history
  • Loading branch information
escapedcat committed Nov 2, 2021
1 parent c285805 commit b822c33
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion @commitlint/prompt/src/index.ts
@@ -1,5 +1,5 @@
import inquirer from 'inquirer';
import input from './input';
import {input} from './input';

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

Expand Down
2 changes: 1 addition & 1 deletion @commitlint/prompt/src/input.test.ts
@@ -1,6 +1,6 @@
import {Answers, PromptModule, QuestionCollection} from 'inquirer';
/// <reference path="./inquirer/inquirer.d.ts" />
import input from './input';
import {input} from './input';
import chalk from 'chalk';

jest.mock(
Expand Down
10 changes: 5 additions & 5 deletions @commitlint/prompt/src/input.ts
Expand Up @@ -4,7 +4,7 @@ import {DistinctQuestion, PromptModule} from 'inquirer';
import format from './library/format';
import getPrompt from './library/get-prompt';
import settings from './settings';
import {InputSetting, Result} from './library/types';
import type {InputSetting, Result} from './library/types';

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

for (const input of parts) {
const inputSettings: InputSetting = settings[input];
const inputSetting: InputSetting = settings[input];
const inputRules = getRules(input, rules);
if (headerParts.includes(input) && maxLength < Infinity) {
inputSettings.header = {
inputSetting.header = {
length: maxLength,
};
}
const question = getPrompt(input, inputRules, inputSettings);
const question = getPrompt(input, inputRules, inputSetting);
if (question) {
questions.push(question);
}
Expand Down

0 comments on commit b822c33

Please sign in to comment.