Skip to content

Commit c4b8b70

Browse files
committed
feat(interfaces): PromptConfig
Signed-off-by: Lexus Drumgold <unicornware@flexdevelopment.llc>
1 parent 15302ed commit c4b8b70

File tree

3 files changed

+61
-0
lines changed

3 files changed

+61
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/**
2+
* @file Type Tests - PromptConfig
3+
* @module commitlint-config/interfaces/tests/unit-d/PromptConfig
4+
*/
5+
6+
import type { Questions } from '#src/types'
7+
import type * as commitlint from '@commitlint/types'
8+
import type TestSubject from '../config-prompt'
9+
10+
describe('unit-d:interfaces/PromptConfig', () => {
11+
it('should extend commitlint.PromptConfig', () => {
12+
expectTypeOf<TestSubject>().toMatchTypeOf<commitlint.PromptConfig>()
13+
})
14+
15+
it('should match [questions: Questions]', () => {
16+
expectTypeOf<TestSubject>()
17+
.toHaveProperty('questions')
18+
.toEqualTypeOf<Questions>()
19+
})
20+
})

src/interfaces/config-prompt.ts

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/**
2+
* @file Interfaces - PromptConfig
3+
* @module commitlint-config/interfaces/PromptConfig
4+
*/
5+
6+
import type { Questions } from '#src/types'
7+
import type * as commitlint from '@commitlint/types'
8+
9+
/**
10+
* Object representing prompt configuration used by `@commitlint/cz-commitlint`.
11+
*
12+
* @see https://commitlint.js.org/#/reference-prompt
13+
* @see https://github.com/conventional-changelog/commitlint/tree/master/%40commitlint/cz-commitlint
14+
*
15+
* @extends {commitlint.PromptConfig}
16+
*/
17+
interface PromptConfig extends commitlint.PromptConfig {
18+
/**
19+
* Message hints.
20+
*
21+
* @see https://commitlint.js.org/#/reference-prompt?id=messages
22+
*/
23+
messages: commitlint.PromptConfig['messages']
24+
25+
/**
26+
* Interactive steps.
27+
*
28+
* @see https://commitlint.js.org/#/reference-prompt?id=questions
29+
*/
30+
questions: Questions
31+
32+
/**
33+
* Additional prompt settings.
34+
*
35+
* @see https://commitlint.js.org/#/reference-prompt?id=settings
36+
*/
37+
settings: commitlint.PromptConfig['settings']
38+
}
39+
40+
export type { PromptConfig as default }

src/interfaces/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@
33
* @module commitlint-config/interfaces
44
*/
55

6+
export type { default as PromptConfig } from './config-prompt'
67
export type { default as ParserOptions } from './options-parser'

0 commit comments

Comments
 (0)