eslint-mdx: [v2] incorrect comment loc info
Initial checklist
- I read the support docs
- I read the contributing guide
- I agree to follow the code of conduct
- I searched issues and couldn’t find anything (or linked relevant results below)
Affected packages and versions
2.0.0.next.1
Link to runnable example
No response
Steps to reproduce
{/* First */}
<Story>
{{
template: /* HTML */ ``,
}}
</Story>
print with console.log(JSON.stringify(node.data?.estree.comments || [], null, 2))
Expected behavior
The second comment should start with line: 5, column: 14
and end with line: 5, column: 24
Actual behavior
[
{
"type": "Block",
"value": " First ",
"start": 1,
"end": 12,
"loc": {
"start": {
"line": 1,
"column": 1
},
"end": {
"line": 1,
"column": 12
}
},
"range": [
1,
12
]
}
]
[
{
"type": "Block",
"value": " HTML ",
"start": 42,
"end": 52,
"loc": {
"start": {
"line": 4,
"column": 19
},
"end": {
"line": 4,
"column": 29
}
},
"range": [
42,
52
]
}
]
Runtime
Node v16
Package manager
yarn v1
OS
macOS
Build and bundle tools
No response
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 15 (15 by maintainers)
Commits related to this issue
- fix: correct loc of comments, add offset into loc point related https://github.com/mdx-js/eslint-mdx/issues/380 — committed to JounQin/micromark-extension-mdx-expression by JounQin 2 years ago
- Fix some positional info of estrees Related-to: mdx-js/eslint-mdx#380. Related-to: micromark/micromark-extension-mdx-expression#2. — committed to micromark/micromark-extension-mdx-expression by wooorm 2 years ago
- Fix buggy ESM parsing Related-to: dc9f760. Related-to: mdx-js/eslint-mdx#380. — committed to micromark/micromark-extension-mdx-expression by wooorm 2 years ago
done
I’m not sure how I came up with the previous logic. I made a little algorithm locally that works and is much simpler. I’ll have to make the code pretty and add test it all, but should have it ready soon!
I forgot it’s in
estree
.This is how
storybook
for Angular works.OK, I will give it a try today.
2.0.0.next.1
iseslint-mdx
So this is a known issue? Are you going to fix it?