Skip to content

Commit 07992e1

Browse files
committedJun 11, 2022
Add some small improvements to docs
1 parent e835acf commit 07992e1

File tree

2 files changed

+32
-12
lines changed

2 files changed

+32
-12
lines changed
 

‎lib/index.js

+17-3
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,22 @@
44
* @typedef {import('vfile-statistics').Statistics} Statistics
55
*
66
* @typedef Options
7+
* Configuration (optional).
78
* @property {boolean} [color]
8-
* @property {boolean} [silent=false]
9-
* @property {boolean} [quiet=false]
9+
* Use ANSI colors in report (default: depends).
10+
* The default behavior in Node.js is the check if color is supported.
1011
* @property {boolean} [verbose=false]
12+
* Show message `note`s.
13+
* Notes are optional, additional, long descriptions.
14+
* @property {boolean} [quiet=false]
15+
* Do not show files without messages.
16+
* @property {boolean} [silent=false]
17+
* Show errors only.
18+
* This does not show info and warning messages.
19+
* Also sets `quiet` to `true`.
1120
* @property {string} [defaultName='<stdin>']
21+
* Label to use for files without file path.
22+
* If one file and no `defaultName` is given, no name will show up in the report.
1223
*
1324
* @typedef Row
1425
* @property {string} place
@@ -52,11 +63,14 @@ const labels = {
5263
}
5364

5465
/**
55-
* Report a file’s messages.
66+
* Create a report from an error, one file, or multiple files.
5667
*
5768
* @param {Error|VFile|Array<VFile>} [files]
69+
* File(s) or error to report.
5870
* @param {Options} [options]
71+
* Configuration.
5972
* @returns {string}
73+
* Report.
6074
*/
6175
export function reporter(files, options = {}) {
6276
/** @type {boolean|undefined} */

‎readme.md

+15-9
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
[![Backers][backers-badge]][collective]
88
[![Chat][chat-badge]][chat]
99

10-
[vfile][] utility to create a report from a file.
10+
[vfile][] utility to create a report.
1111

1212
![Example screenshot of vfile-reporter][screenshot]
1313

@@ -38,6 +38,9 @@ bundlers (such as esbuild), have similar functionality.
3838
You can use this package whenever you want to display a report about what
3939
occurred while processing to a human.
4040

41+
There are [other reporters][reporters] that display information differently
42+
listed in vfile.
43+
4144
## Install
4245

4346
This package is [ESM only][esm].
@@ -63,7 +66,7 @@ In browsers with [`esm.sh`][esmsh]:
6366

6467
## Use
6568

66-
Say `example.js` contains:
69+
Say our module `example.js` looks as follows:
6770

6871
```js
6972
import {VFile} from 'vfile'
@@ -77,7 +80,7 @@ one.message('Warning!', {line: 2, column: 4})
7780
console.error(reporter([one, two]))
7881
```
7982

80-
Now, running `node example` yields:
83+
…now running `node example.js` yields:
8184

8285
```txt
8386
test/fixture/1.js
@@ -95,7 +98,7 @@ That value is also the default export.
9598

9699
### `reporter(files[, options])`
97100

98-
Create a report from an error, on file, or multiple files.
101+
Create a report from an error, one file, or multiple files.
99102

100103
##### `options`
101104

@@ -104,7 +107,8 @@ Configuration (optional).
104107
###### `options.color`
105108

106109
Use ANSI colors in report (`boolean`, default: depends).
107-
The default behavior is the check if [color is supported][supports-color].
110+
The default behavior in Node.js is the check if [color is
111+
supported][supports-color].
108112

109113
###### `options.verbose`
110114

@@ -128,7 +132,7 @@ If one file and no `defaultName` is given, no name will show up in the report.
128132

129133
##### Returns
130134

131-
`string`.
135+
Report (`string`).
132136

133137
## Types
134138

@@ -139,7 +143,7 @@ It exports the additional type `Options`.
139143

140144
Projects maintained by the unified collective are compatible with all maintained
141145
versions of Node.js.
142-
As of now, that is Node.js 12.20+, 14.14+, and 16.0+.
146+
As of now, that is Node.js 12.20+, 14.14+, 16.0+, and 18.0+.
143147
Our projects sometimes work with older versions, but this is not guaranteed.
144148

145149
## Security
@@ -171,7 +175,7 @@ abide by its terms.
171175

172176
[MIT][license] © [Titus Wormer][author]
173177

174-
Forked from [ESLint][]s stylish reporter
178+
Forked from [ESLint][]s stylish reporter
175179
(originally created by Sindre Sorhus), which is Copyright (c) 2013
176180
Nicholas C. Zakas, and licensed under MIT.
177181

@@ -223,8 +227,10 @@ Nicholas C. Zakas, and licensed under MIT.
223227

224228
[vfile]: https://github.com/vfile/vfile
225229

226-
[screenshot]: ./screenshot.png
230+
[reporters]: https://github.com/vfile/vfile#reporters
227231

228232
[supports-color]: https://github.com/chalk/supports-color
229233

230234
[message-note]: https://github.com/vfile/vfile-message#note
235+
236+
[screenshot]: screenshot.png

0 commit comments

Comments
 (0)
Please sign in to comment.