Skip to content

Commit 3018cd5

Browse files
committed
feat(interfaces): Reference
Signed-off-by: Lexus Drumgold <unicornware@flexdevelopment.llc>
1 parent 6079b7e commit 3018cd5

File tree

3 files changed

+87
-0
lines changed

3 files changed

+87
-0
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/**
2+
* @file Type Tests - Reference
3+
* @module commitlint-config/interfaces/tests/unit-d/Reference
4+
*/
5+
6+
import type { ReferenceAction } from '#src/enums'
7+
import type { Nullable } from '@flex-development/tutils'
8+
import type TestSubject from '../reference'
9+
10+
describe('unit-d:interfaces/Reference', () => {
11+
it('should match [action: Nullable<ReferenceAction>]', () => {
12+
expectTypeOf<TestSubject>()
13+
.toHaveProperty('action')
14+
.toEqualTypeOf<Nullable<ReferenceAction>>()
15+
})
16+
17+
it('should match [issue: string]', () => {
18+
expectTypeOf<TestSubject>().toHaveProperty('issue').toBeString()
19+
})
20+
21+
it('should match [owner: Nullable<string>]', () => {
22+
expectTypeOf<TestSubject>()
23+
.toHaveProperty('owner')
24+
.toEqualTypeOf<Nullable<string>>()
25+
})
26+
27+
it('should match [prefix: string]', () => {
28+
expectTypeOf<TestSubject>().toHaveProperty('prefix').toBeString()
29+
})
30+
31+
it('should match [raw: string]', () => {
32+
expectTypeOf<TestSubject>().toHaveProperty('raw').toBeString()
33+
})
34+
35+
it('should match [repository: Nullable<string>]', () => {
36+
expectTypeOf<TestSubject>()
37+
.toHaveProperty('repository')
38+
.toEqualTypeOf<Nullable<string>>()
39+
})
40+
})

src/interfaces/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ export type { default as Config } from './config'
77
export type { default as PromptConfig } from './config-prompt'
88
export type { default as RulesConfig } from './config-rules'
99
export type { default as ParserOptions } from './options-parser'
10+
export type { default as Reference } from './reference'
1011
export type { default as Revert } from './revert'

src/interfaces/reference.ts

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/**
2+
* @file Interfaces - Reference
3+
* @module commitlint-config/interfaces/Reference
4+
*/
5+
6+
import type { ReferenceAction } from '#src/enums'
7+
import type { Nullable } from '@flex-development/tutils'
8+
9+
/**
10+
* Object representing a reference action in a commit.
11+
*/
12+
interface Reference {
13+
/**
14+
* Reference action, if any.
15+
*/
16+
action: Nullable<ReferenceAction>
17+
18+
/**
19+
* Referenced issue.
20+
*/
21+
issue: string
22+
23+
/**
24+
* Repository owner.
25+
*/
26+
owner: Nullable<string>
27+
28+
/**
29+
* Issue prefix.
30+
*/
31+
prefix: string
32+
33+
/**
34+
* Raw reference from commit.
35+
*/
36+
raw: string
37+
38+
/**
39+
* Name of repository the reference belongs to.
40+
*
41+
* If `null`, reference is from `origin`.
42+
*/
43+
repository: Nullable<string>
44+
}
45+
46+
export type { Reference as default }

0 commit comments

Comments
 (0)