Skip to content

Commit 2a5f455

Browse files
committed
Add improved docs
1 parent 0b9555b commit 2a5f455

File tree

3 files changed

+26
-12
lines changed

3 files changed

+26
-12
lines changed

index.js

+4
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1+
/**
2+
* @typedef {import('./lib/index.js').LintResult} LintResult
3+
*/
4+
15
export {toESLint} from './lib/index.js'

lib/index.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
import {statistics} from 'vfile-statistics'
99

1010
/**
11-
* Turn virtual files into a ESLint results.
11+
* Turn virtual files into a ESLint results that can be passed directly to an
12+
* ESLint formatter.
1213
*
1314
* @param {Array<VFile>} files
1415
* Virtual files.

readme.md

+20-11
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ In other cases, a custom vfile utility might be a better solution.
3838
## Install
3939

4040
This package is [ESM only][esm].
41-
In Node.js (version 12.20+, 14.14+, 16.0+, 18.0+), install with [npm][]:
41+
In Node.js (version 14.14+ and 16.0+), install with [npm][]:
4242

4343
```sh
4444
npm install vfile-to-eslint
@@ -62,41 +62,46 @@ In browsers with [`esm.sh`][esmsh]:
6262

6363
```js
6464
import remark from 'remark'
65-
import recommended from 'remark-preset-lint-recommended'
65+
import remarkPresetLintRecommended from 'remark-preset-lint-recommended'
6666
import eslintFormatterPretty from 'eslint-formatter-pretty'
6767
import {toESLint} from 'vfile-to-eslint'
6868

69-
const file = remark()
70-
.use(recommended)
71-
.processSync('## Hello world!')
69+
const file = await remark()
70+
.use(remarkPresetLintRecommended)
71+
.process('## Hello world!')
7272

7373
console.log(eslintFormatterPretty(toESLint([file])))
7474
```
7575

7676
## API
7777

78-
This package exports the identifier `toESLint`.
78+
This package exports the identifier [`toESLint`][api-to-eslint].
7979
There is no default export.
8080

8181
### `toESLint(files)`
8282

83-
Returns an `LintResult` that can be passed directly to an
83+
Turn virtual files into a ESLint results that can be passed directly to an
8484
[ESLint formatter][eslint-formatter].
8585

86-
###### `files`
86+
###### Parameters
8787

88-
List of files ([`Array<VFile>`][vfile]).
88+
* `files` ([`Array<VFile>`][vfile])
89+
— list of files
90+
91+
###### Returns
92+
93+
Lint results ([`Array<LintResult>`][lintresult])
8994

9095
## Types
9196

9297
This package is fully typed with [TypeScript][].
93-
It exports the additional type `LintResult`.
98+
It exports the additional type [`LintResult`][lintresult].
9499

95100
## Compatibility
96101

97102
Projects maintained by the unified collective are compatible with all maintained
98103
versions of Node.js.
99-
As of now, that is Node.js 12.20+, 14.14+, 16.0+, and 18.0+.
104+
As of now, that is Node.js 14.14+ and 16.0+.
100105
Our projects sometimes work with older versions, but this is not guaranteed.
101106

102107
## Contribute
@@ -164,3 +169,7 @@ abide by its terms.
164169
[eslint]: https://eslint.org
165170

166171
[eslint-formatter]: https://npms.io/search?term=eslint-formatter
172+
173+
[lintresult]: https://eslint.org/docs/latest/integrate/nodejs-api#-lintresult-type
174+
175+
[api-to-eslint]: #toeslintfiles

0 commit comments

Comments
 (0)