Skip to content

Commit d10a468

Browse files
committed
Add improved docs
1 parent e5341dc commit d10a468

File tree

3 files changed

+291
-81
lines changed

3 files changed

+291
-81
lines changed

index.d.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,13 @@ type MaybeBuffer = any extends Buffer ? never : Buffer
1111

1212
/**
1313
* Contents of the file.
14-
* Can either be text, or a Buffer like structure.
15-
* This does not directly use type `Buffer`, because it can also be used in a
16-
* browser context.
17-
* Instead this leverages `Uint8Array` which is the base type for `Buffer`,
18-
* and a native JavaScript construct.
14+
*
15+
* Can either be text or a `Buffer` structure.
1916
*/
17+
// Note: this does not directly use type `Buffer`, because it can also be used
18+
// in a browser context.
19+
// Instead this leverages `Uint8Array` which is the base type for `Buffer`,
20+
// and a native JavaScript construct.
2021
export type Value = string | MaybeBuffer
2122

2223
/**
@@ -37,7 +38,7 @@ export type Value = string | MaybeBuffer
3738
export interface DataMap {}
3839

3940
/**
40-
* Place to store custom information.
41+
* Custom information.
4142
*
4243
* Known attributes can be added to @see {@link DataMap}
4344
*/

lib/index.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* being needed.
1818
* Copied from: <https://github.com/DefinitelyTyped/DefinitelyTyped/blob/90a4ec8/types/node/buffer.d.ts#L170>
1919
*
20-
* @typedef {Value | Options | VFile | URL} Compatible
20+
* @typedef {Options | URL | Value | VFile} Compatible
2121
* Things that can be passed to the constructor.
2222
*
2323
* @typedef VFileCoreOptions
@@ -42,7 +42,9 @@
4242
* Set `data`.
4343
*
4444
* @typedef Map
45-
* Raw source map, see:
45+
* Raw source map.
46+
*
47+
* See:
4648
* <https://github.com/mozilla/source-map/blob/58819f0/source-map.d.ts#L15-L23>.
4749
* @property {number} version
4850
* Which version of the source map spec this map is following.
@@ -72,7 +74,7 @@
7274
* @template {ReporterSettings} Settings
7375
* Options type.
7476
* @callback Reporter
75-
* Type for a report.
77+
* Type for a reporter.
7678
* @param {Array<VFile>} files
7779
* Files to report.
7880
* @param {Settings} options
@@ -403,7 +405,7 @@ export class VFile {
403405
}
404406

405407
/**
406-
* Create an informational message associated with the file.
408+
* Create an info message associated with the file.
407409
*
408410
* Its `fatal` is set to `null` and `file` is set to the current file path.
409411
* Its added to `file.messages`.
@@ -443,6 +445,8 @@ export class VFile {
443445
* `'my-package:my-rule'` or `'my-rule'`).
444446
* @returns {never}
445447
* Message.
448+
* @throws {VFileMessage}
449+
* Message.
446450
*/
447451
fail(reason, place, origin) {
448452
const message = this.message(reason, place, origin)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy