Skip to content

Commit 06ce625

Browse files
committedFeb 4, 2023
Add improved docs
1 parent 3ed70ba commit 06ce625

File tree

2 files changed

+43
-38
lines changed

2 files changed

+43
-38
lines changed
 

‎lib/index.js

+9-7
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,23 @@
88
* @typedef Options
99
* Configuration (optional).
1010
* @property {boolean | null | undefined} [color]
11-
* Use ANSI colors in report (default: depends).
11+
* Use ANSI colors in report.
1212
* The default behavior in Node.js is the check if color is supported.
1313
* @property {boolean | null | undefined} [verbose=false]
1414
* Show message `note`s.
1515
* Notes are optional, additional, long descriptions.
1616
* @property {boolean | null | undefined} [quiet=false]
1717
* Do not show files without messages.
1818
* @property {boolean | null | undefined} [silent=false]
19-
* Show errors only.
20-
* This does not show info and warning messages.
21-
* Also sets `quiet` to `true`.
19+
* Show errors only, this hides info and warning messages, and sets
20+
* `quiet: true`.
2221
* @property {string | null | undefined} [defaultName='<stdin>']
2322
* Label to use for files without file path.
24-
* If one file and no `defaultName` is given, no name will show up in the report.
25-
*
23+
* If one file and no `defaultName` is given, no name will show up in the
24+
* report.
25+
*/
26+
27+
/**
2628
* @typedef MessageRow
2729
* Message.
2830
* @property {string} place
@@ -85,7 +87,7 @@ const labels = {
8587
* Create a report from an error, one file, or multiple files.
8688
*
8789
* @param {Error | VFile | Array<VFile> | null | undefined} [files]
88-
* File(s) or error to report.
90+
* Files or error to report.
8991
* @param {Options | null | undefined} [options]
9092
* Configuration.
9193
* @returns {string}

‎readme.md

+34-31
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
* [Use](#use)
2020
* [API](#api)
2121
* [`reporter(files[, options])`](#reporterfiles-options)
22+
* [`Options`](#options)
2223
* [Types](#types)
2324
* [Compatibility](#compatibility)
2425
* [Security](#security)
@@ -44,7 +45,7 @@ listed in vfile.
4445
## Install
4546

4647
This package is [ESM only][esm].
47-
In Node.js (version 12.20+, 14.14+, or 16.0+), install with [npm][]:
48+
In Node.js (version 14.14+ and 16.0+), install with [npm][]:
4849

4950
```sh
5051
npm install vfile-reporter
@@ -93,57 +94,55 @@ test/fixture/2.js: no issues found
9394

9495
## API
9596

96-
This package exports the identifier `reporter`.
97-
That value is also the default export.
97+
This package exports the identifier [`reporter`][api-reporter].
98+
That value is also the `default` export.
9899

99100
### `reporter(files[, options])`
100101

101102
Create a report from an error, one file, or multiple files.
102103

103-
##### `options`
104+
###### Parameters
104105

105-
Configuration (optional).
106+
* `files` ([`VFile`][vfile], `Array<VFile>`, or `Error`)
107+
— files or error to report
108+
* `options` ([`Options`][api-options], optional)
109+
— configuration
106110

107-
###### `options.color`
111+
###### Returns
108112

109-
Use ANSI colors in report (`boolean`, default: depends).
110-
The default behavior in Node.js is the check if [color is
111-
supported][supports-color].
112-
113-
###### `options.verbose`
114-
115-
Show message [`note`][message-note]s (`boolean`, default: `false`).
116-
Notes are optional, additional, long descriptions.
117-
118-
###### `options.quiet`
119-
120-
Do not show files without messages (`boolean`, default: `false`).
121-
122-
###### `options.silent`
123-
124-
Show errors only (`boolean`, default: `false`).
125-
This does not show info and warning messages.
126-
Also sets `quiet` to `true`.
113+
Report (`string`).
127114

128-
###### `options.defaultName`
115+
### `Options`
129116

130-
Label to use for files without file path (`string`, default: `'<stdin>'`).
131-
If one file and no `defaultName` is given, no name will show up in the report.
117+
Configuration (TypeScript type).
132118

133-
##### Returns
119+
###### Fields
134120

135-
Report (`string`).
121+
* `color` (`boolean`, default: depends)
122+
— use ANSI colors in report, the default behavior in Node.js is the check
123+
if [color is supported][supports-color]
124+
* `verbose` (`boolean`, default: `false`)
125+
— show message [`note`][message-note]s, notes are optional, additional,
126+
long descriptions
127+
* `quiet` (`boolean`, default: `false`)
128+
— do not show files without messages
129+
* `silent` (`boolean`, default: `false`)
130+
— show errors only, this hides info and warning messages, and sets
131+
`quiet: true`
132+
* `defaultName` (`string`, default: `'<stdin>'`).
133+
— label to use for files without file path, if one file and no
134+
`defaultName` is given, no name will show up in the report
136135

137136
## Types
138137

139138
This package is fully typed with [TypeScript][].
140-
It exports the additional type `Options`.
139+
It exports the additional type [`Options`][api-options].
141140

142141
## Compatibility
143142

144143
Projects maintained by the unified collective are compatible with all maintained
145144
versions of Node.js.
146-
As of now, that is Node.js 12.20+, 14.14+, 16.0+, and 18.0+.
145+
As of now, that is Node.js 14.14+ and 16.0+.
147146
Our projects sometimes work with older versions, but this is not guaranteed.
148147

149148
## Security
@@ -234,3 +233,7 @@ Nicholas C. Zakas, and licensed under MIT.
234233
[message-note]: https://github.com/vfile/vfile-message#note
235234

236235
[screenshot]: screenshot.png
236+
237+
[api-reporter]: #reporterfiles-options
238+
239+
[api-options]: #options

0 commit comments

Comments
 (0)
Please sign in to comment.