Skip to content

Commit 55130c7

Browse files
committed
fix: incorrect JSXAttribute position info
close #488, related #425
1 parent f6bcfb0 commit 55130c7

File tree

3 files changed

+582
-805
lines changed

3 files changed

+582
-805
lines changed

packages/eslint-mdx/src/worker.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,7 @@ runAsWorker(
633633
}
634634

635635
return {
636-
...attrNamePos,
636+
...normalizeNode(attrStart, lastAttrOffset + 1),
637637
type: 'JSXAttribute',
638638
name: {
639639
...attrNamePos,
@@ -713,11 +713,16 @@ runAsWorker(
713713

714714
const expression = handleNode(node)
715715

716+
// keep for debugging
717+
// if (+1 === 1) {
718+
// throw new SyntaxError(JSON.stringify({ node, expression }, null, 2))
719+
// }
720+
716721
if (expression) {
717722
body.push({
718723
...normalizePosition(node.position),
719724
type: 'ExpressionStatement',
720-
expression: handleNode(node) as Expression,
725+
expression: expression as Expression,
721726
})
722727
}
723728

0 commit comments

Comments
 (0)