Skip to content

Commit 40cb3e0

Browse files
committed
Add note in readme on espree
1 parent 2bf62d0 commit 40cb3e0

File tree

1 file changed

+6
-15
lines changed

1 file changed

+6
-15
lines changed

readme.md

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,17 @@
88
[![Backers][backers-badge]][collective]
99
[![Chat][chat-badge]][chat]
1010

11-
Attach semistandard [estree][] comment nodes (such as from [espree][] or
12-
[acorn][] with a couple lines of code) to the nodes in that tree.
11+
Attach semistandard [estree][] comment nodes (such as from [acorn][] with a
12+
couple lines of code) to the nodes in that tree.
1313

1414
This is useful because certain estree parsers give you an array (espree and
1515
acorn) whereas other estree tools expect comments to be embedded on nodes in the
1616
tree.
1717

18+
This package uses one `comments` array where each comment has `leading`
19+
and `trailing` fields.
20+
Note that espree uses slightly different non-standard comments.
21+
1822
## Install
1923

2024
This package is ESM only: Node 12+ is needed to use it and it must be `import`ed
@@ -72,17 +76,6 @@ a(
7276
Note that the lines are added by `recast` in this case.
7377
And, some of these weird comments are off, but they’re pretty close.
7478

75-
With espree:
76-
77-
```js
78-
import espree from 'espree'
79-
import {attachComments} from 'estree-util-attach-comments'
80-
81-
var tree = espree.parse(code, {comment: true, ecmaVersion: 2020})
82-
83-
attachComments(tree, tree.comments)
84-
```
85-
8679
## API
8780

8881
This package exports the following identifiers: `attachComments`.
@@ -156,6 +149,4 @@ and direct `start` / `end` fields.
156149

157150
[estree]: https://github.com/estree/estree
158151

159-
[espree]: https://github.com/eslint/espree
160-
161152
[program]: https://github.com/estree/estree/blob/master/es5.md#programs

0 commit comments

Comments
 (0)