Skip to content

Commit d0511f1

Browse files
committed
docs: api
Signed-off-by: Lexus Drumgold <unicornware@flexdevelopment.llc>
1 parent 2cd6e44 commit d0511f1

File tree

3 files changed

+118
-5
lines changed

3 files changed

+118
-5
lines changed

README.md

Lines changed: 116 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,19 @@ Shareable [`commitlint`][1] config enforcing [conventional commits][2]
1919
- [Use](#use)
2020
- [Customizing scopes and types](#customizing-scopes-and-types)
2121
- [API](#api)
22+
- [`config`](#config)
23+
- `defaultIgnores`
24+
- `formatter`
25+
- `helpUrl`
26+
- `ignores`
27+
- [`max(array)`](#maxarray)
28+
- [`min(array)`](#minarray)
29+
- `parserPreset`
30+
- `plugins`
31+
- `prompt`
32+
- `rules`
33+
- [`scopes([extras])`](#scopesextras)
34+
- [`types([extras])`](#typesextras)
2235
- [Types](#types)
2336
- [Enums](#enums)
2437
- [Interfaces](#interfaces)
@@ -106,11 +119,110 @@ See [`docs/examples/commitlint.config.cjs`](docs/examples/commitlint.config.cjs)
106119

107120
## API
108121

109-
**TODO**: api documentation.
122+
This package exports the following identifiers:
123+
124+
- [`config`](#config)
125+
- `defaultIgnores`
126+
- `formatter`
127+
- `helpUrl`
128+
- `ignores`
129+
- [`max`](#maxarray)
130+
- [`min`](#minarray)
131+
- `parserPreset`
132+
- `plugins`
133+
- `prompt`
134+
- `rules`
135+
- [`scopes`](#scopesextras)
136+
- [`types`](#typesextras)
137+
138+
The default export is `config`.
139+
140+
### `config`
141+
142+
`commitlint` configuration object.
143+
144+
Properties:
145+
146+
- `defaultIgnores`
147+
- `formatter`
148+
- `helpUrl`
149+
- `ignores`
150+
- `parserPreset`
151+
- `plugins`
152+
- `prompt`
153+
- `rules`
154+
155+
See the [configuration reference][11] for more details.
156+
157+
### Utilities
158+
159+
#### `max(array)`
160+
161+
Returns the length of the longest string in the given `array`.
162+
163+
##### Parameters
164+
165+
- `{string[]}` **`array`** &mdash; Array to evaluate
166+
167+
##### Returns
168+
169+
`{number}` Length of longest string in `array`.
170+
171+
##### Source
172+
173+
> [`src/utils/max.ts`](src/utils/max.ts)
174+
175+
#### `min(array)`
176+
177+
Returns the length of the shortest string in the given `array`.
178+
179+
##### Parameters
180+
181+
- `{string[]}` **`array`** &mdash; Array to evaluate
182+
183+
##### Returns
184+
185+
`{number}` Length of shortest string in `array`.
186+
187+
##### Source
188+
189+
> [`src/utils/min.ts`](src/utils/min.ts)
190+
191+
#### `scopes([extras])`
192+
193+
Returns an array containing valid commit scopes.
194+
195+
##### Parameters
196+
197+
- `{(Set<string> | string[])?}` **`[extras=[]]`** &mdash; Additional commit scopes
198+
199+
##### Returns
200+
201+
`{LiteralUnion<Scope, string>[]}` Commit scopes array.
202+
203+
##### Source
204+
205+
> [`src/utils/scopes.ts`](src/utils/scopes.ts)
206+
207+
#### `types([extras])`
208+
209+
Returns an array containing valid commit types.
210+
211+
##### Parameters
212+
213+
- `{(Set<string> | string[])?}` **`[extras=[]]`** &mdash; Additional commit types
214+
215+
##### Returns
216+
217+
`{LiteralUnion<Type, string>[]}` Commit types array.
218+
219+
##### Source
220+
221+
> [`src/utils/types.ts`](src/utils/types.ts)
110222
111223
## Types
112224

113-
This package is fully typed with [TypeScript][11].
225+
This package is fully typed with [TypeScript][12].
114226

115227
### Enums
116228

@@ -152,4 +264,5 @@ See [`CONTRIBUTING.md`](CONTRIBUTING.md).
152264
[8]: https://commitlint.js.org/#/reference-rules?id=scope-enum
153265
[9]: https://commitlint.js.org/#/reference-rules?id=type-enum
154266
[10]: https://typestrong.org/ts-node/docs/options#project
155-
[11]: https://www.typescriptlang.org
267+
[11]: https://commitlint.js.org/#/reference-configuration
268+
[12]: https://www.typescriptlang.org

src/utils/scopes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { Scope } from '#src/enums'
77
import type { LiteralUnion } from '@flex-development/tutils'
88

99
/**
10-
* Returns an array of valid commit scopes.
10+
* Returns an array containing valid commit scopes.
1111
*
1212
* @param {(Set<string> | string[])?} [extras=[]] - Additional commit scopes
1313
* @return {LiteralUnion<Scope, string>[]} Commit scopes array

src/utils/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { Type } from '#src/enums'
77
import type { LiteralUnion } from '@flex-development/tutils'
88

99
/**
10-
* Returns an array of valid commit types.
10+
* Returns an array containing valid commit types.
1111
*
1212
* @param {(Set<string> | string[])?} [extras=[]] - Additional commit types
1313
* @return {LiteralUnion<Type, string>[]} Commit types array

0 commit comments

Comments
 (0)