@@ -38,7 +38,7 @@ In other cases, a custom vfile utility might be a better solution.
38
38
## Install
39
39
40
40
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] [ ] :
42
42
43
43
``` sh
44
44
npm install vfile-to-eslint
@@ -62,41 +62,46 @@ In browsers with [`esm.sh`][esmsh]:
62
62
63
63
``` js
64
64
import remark from ' remark'
65
- import recommended from ' remark-preset-lint-recommended'
65
+ import remarkPresetLintRecommended from ' remark-preset-lint-recommended'
66
66
import eslintFormatterPretty from ' eslint-formatter-pretty'
67
67
import {toESLint } from ' vfile-to-eslint'
68
68
69
- const file = remark ()
70
- .use (recommended )
71
- .processSync (' ## Hello world!' )
69
+ const file = await remark ()
70
+ .use (remarkPresetLintRecommended )
71
+ .process (' ## Hello world!' )
72
72
73
73
console .log (eslintFormatterPretty (toESLint ([file])))
74
74
```
75
75
76
76
## API
77
77
78
- This package exports the identifier ` toESLint ` .
78
+ This package exports the identifier [ ` toESLint ` ] [ api-to-eslint ] .
79
79
There is no default export.
80
80
81
81
### ` toESLint(files) `
82
82
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
84
84
[ ESLint formatter] [ eslint-formatter ] .
85
85
86
- ###### ` files `
86
+ ###### Parameters
87
87
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 ] )
89
94
90
95
## Types
91
96
92
97
This package is fully typed with [ TypeScript] [ ] .
93
- It exports the additional type ` LintResult ` .
98
+ It exports the additional type [ ` LintResult ` ] [ lintresult ] .
94
99
95
100
## Compatibility
96
101
97
102
Projects maintained by the unified collective are compatible with all maintained
98
103
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+.
100
105
Our projects sometimes work with older versions, but this is not guaranteed.
101
106
102
107
## Contribute
@@ -164,3 +169,7 @@ abide by its terms.
164
169
[ eslint ] : https://eslint.org
165
170
166
171
[ 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