Skip to content

Commit eba2db5

Browse files
committed
Add improved docs
1 parent 6543ebd commit eba2db5

File tree

3 files changed

+323
-276
lines changed

3 files changed

+323
-276
lines changed

lib/options.js

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ const minischema = {
4343
default: {},
4444
/** @type {Record<string, string>} */
4545
alias: {},
46-
/** @type {string[]} */
46+
/** @type {Array<string>} */
4747
string: [],
48-
/** @type {string[]} */
48+
/** @type {Array<string>} */
4949
boolean: []
5050
}
5151

@@ -57,7 +57,7 @@ while (++index < schema.length) {
5757
/**
5858
* Parse CLI options.
5959
*
60-
* @param {string[]} flags
60+
* @param {Array<string>} flags
6161
* @param {Options} configuration
6262
*/
6363
export function options(flags, configuration) {
@@ -152,8 +152,8 @@ function addEach(option) {
152152
/**
153153
* Parse `extensions`.
154154
*
155-
* @param {string[]|string|null|undefined} value
156-
* @returns {string[]}
155+
* @param {Array<string>|string|null|undefined} value
156+
* @returns {Array<string>}
157157
*/
158158
function commaSeparated(value) {
159159
return flatten(normalize(value).map((d) => splitList(d)))
@@ -162,7 +162,7 @@ function commaSeparated(value) {
162162
/**
163163
* Parse `plugins`.
164164
*
165-
* @param {string[]|string|null|undefined} value
165+
* @param {Array<string>|string|null|undefined} value
166166
* @returns {Record<string, Record<string, unknown>|undefined>}
167167
*/
168168
function plugins(value) {
@@ -182,7 +182,7 @@ function plugins(value) {
182182
/**
183183
* Parse `reporter`: only one is accepted.
184184
*
185-
* @param {string[]|string|null|undefined} value
185+
* @param {Array<string>|string|null|undefined} value
186186
* @returns {[string|undefined, Record<string, unknown>|undefined]}
187187
*/
188188
function reporter(value) {
@@ -201,7 +201,7 @@ function reporter(value) {
201201
/**
202202
* Parse `settings`.
203203
*
204-
* @param {string[]|string|null|undefined} value
204+
* @param {Array<string>|string|null|undefined} value
205205
* @returns {Record<string, unknown>}
206206
*/
207207
function settings(value) {
@@ -293,7 +293,7 @@ function handleUnknownArgument(flag) {
293293
/**
294294
* Inspect all `options`.
295295
*
296-
* @param {Option[]} options
296+
* @param {Array<Option>} options
297297
* @returns {string}
298298
*/
299299
function inspectAll(options) {
@@ -304,7 +304,7 @@ function inspectAll(options) {
304304
* Inspect one `option`.
305305
*
306306
* @param {Option} option
307-
* @returns {string[]}
307+
* @returns {Array<string>}
308308
*/
309309
function inspect(option) {
310310
let description = option.description
@@ -326,8 +326,8 @@ function inspect(option) {
326326
/**
327327
* Normalize `value`.
328328
*
329-
* @param {string[]|string|null|undefined} value
330-
* @returns {string[]}
329+
* @param {Array<string>|string|null|undefined} value
330+
* @returns {Array<string>}
331331
*/
332332
function normalize(value) {
333333
if (!value) {
@@ -344,8 +344,8 @@ function normalize(value) {
344344
/**
345345
* Flatten `values`.
346346
*
347-
* @param {string|string[]|string[][]} values
348-
* @returns {string[]}
347+
* @param {string|Array<string>|Array<Array<string>>} values
348+
* @returns {Array<string>}
349349
*/
350350
function flatten(values) {
351351
// @ts-expect-error: TS is wrong.
@@ -354,15 +354,15 @@ function flatten(values) {
354354

355355
/**
356356
* @param {string} value
357-
* @returns {string[]}
357+
* @returns {Array<string>}
358358
*/
359359
function splitOptions(value) {
360360
return value.split('=')
361361
}
362362

363363
/**
364364
* @param {string} value
365-
* @returns {string[]}
365+
* @returns {Array<string>}
366366
*/
367367
function splitList(value) {
368368
return value.split(',')

lib/schema.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* @property {boolean} [truelike=false]
1010
*/
1111

12-
/** @type {Option[]} */
12+
/** @type {Array<Option>} */
1313
export const schema = [
1414
{
1515
long: 'help',

0 commit comments

Comments
 (0)