-
Notifications
You must be signed in to change notification settings - Fork 4
How to make this work with Espree #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
That’s described in the readme of espree https://github.com/eslint/espree#options. |
It doesn't work. Passing |
at the top of the resulting node, as it says, did you try that? |
Yes. Parsing this file: const espree = require("espree")
const { attachComments } = require('./vendor/estree-util-attach-comments.cjs')
code = `
/**
* @callback MyCallback
* @param {number} arg1
*/
const cb = (arg) => 1;
`
ast = espree.parse(code, {comments: true, ecmaVersion: 2021})
console.log(ast) Gives: Node {
type: 'Program',
start: 0,
end: 128,
body: [
Node {
type: 'VariableDeclaration',
start: 97,
end: 119,
declarations: [Array],
kind: 'const'
}
],
sourceType: 'script'
} There is nothing to pass to I want the original attach comment behavior. Not sure if this package helps |
The readme says |
Ah, thanks! I am going to make a PR adding the example to the readme. |
Thanks, appreciate it — but: I’m not interested in a list of examples for every JS parser, because there are so many. Maybe something small? |
Created one: #4 Feel free to merge. |
Espree doesn't have
onComment
likeacorn
. How can I make this work with Espree?The text was updated successfully, but these errors were encountered: