Skip to content

Commit 6079b7e

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

File tree

3 files changed

+113
-0
lines changed

3 files changed

+113
-0
lines changed

Diff for: src/interfaces/__tests__/revert.spec-d.ts

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/**
2+
* @file Type Tests - Revert
3+
* @module commitlint-config/interfaces/tests/unit-d/Revert
4+
*/
5+
6+
import type { Scope, Type } from '#src/enums'
7+
import type { LiteralUnion, Nullable } from '@flex-development/tutils'
8+
import type TestSubject from '../revert'
9+
10+
describe('unit-d:interfaces/Revert', () => {
11+
it('should match [breaking: Nullable<"!">]', () => {
12+
expectTypeOf<TestSubject>()
13+
.toHaveProperty('breaking')
14+
.toEqualTypeOf<Nullable<'!'>>()
15+
})
16+
17+
it('should match [hash: string]', () => {
18+
expectTypeOf<TestSubject>().toHaveProperty('hash').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 [repository: Nullable<string>]', () => {
28+
expectTypeOf<TestSubject>()
29+
.toHaveProperty('repository')
30+
.toEqualTypeOf<Nullable<string>>()
31+
})
32+
33+
it('should match [scope: Nullable<LiteralUnion<Scope, string>>]', () => {
34+
expectTypeOf<TestSubject>()
35+
.toHaveProperty('scope')
36+
.toEqualTypeOf<Nullable<LiteralUnion<Scope, string>>>()
37+
})
38+
39+
it('should match [subject: string]', () => {
40+
expectTypeOf<TestSubject>().toHaveProperty('subject').toBeString()
41+
})
42+
43+
it('should match [type: Type.REVERT]', () => {
44+
expectTypeOf<TestSubject>()
45+
.toHaveProperty('type')
46+
.toEqualTypeOf<Type.REVERT>()
47+
})
48+
49+
it('should match [user: Nullable<string>]', () => {
50+
expectTypeOf<TestSubject>()
51+
.toHaveProperty('user')
52+
.toEqualTypeOf<Nullable<string>>()
53+
})
54+
})

Diff for: src/interfaces/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ 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 Revert } from './revert'

Diff for: src/interfaces/revert.ts

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
/**
2+
* @file Interfaces - Revert
3+
* @module commitlint-config/interfaces/Revert
4+
*/
5+
6+
import type { Scope, Type } from '#src/enums'
7+
import type { LiteralUnion, Nullable } from '@flex-development/tutils'
8+
9+
/**
10+
* Object representing data extracted from a reverted commit.
11+
*
12+
* @see https://docs.github.com/get-started/writing-on-github/working-with-advanced-formatting/autolinked-references-and-urls#commit-shas
13+
*/
14+
interface Revert {
15+
[field: string]: Nullable<string>
16+
17+
/**
18+
* Breaking change indicator.
19+
*/
20+
breaking: Nullable<'!'>
21+
22+
/**
23+
* Reverted commit SHA.
24+
*/
25+
hash: string
26+
27+
/**
28+
* Name of {@linkcode repository} owner.
29+
*/
30+
owner: Nullable<string>
31+
32+
/**
33+
* Name of repository in reverted commit reference.
34+
*/
35+
repository: Nullable<string>
36+
37+
/**
38+
* Commit scope.
39+
*/
40+
scope: Nullable<LiteralUnion<Scope, string>>
41+
42+
/**
43+
* Commit subject.
44+
*/
45+
subject: string
46+
47+
/**
48+
* Commit type.
49+
*/
50+
type: Type.REVERT
51+
52+
/**
53+
* User named in reverted commit reference.
54+
*/
55+
user: Nullable<string>
56+
}
57+
58+
export type { Revert as default }

0 commit comments

Comments
 (0)