Skip to content

Commit

Permalink
fix: incorrect JSXAttribute position info
Browse files Browse the repository at this point in the history
close #488, related #425
  • Loading branch information
JounQin committed Dec 11, 2023
1 parent f6bcfb0 commit 55130c7
Show file tree
Hide file tree
Showing 3 changed files with 582 additions and 805 deletions.
9 changes: 7 additions & 2 deletions packages/eslint-mdx/src/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,7 @@ runAsWorker(
}

return {
...attrNamePos,
...normalizeNode(attrStart, lastAttrOffset + 1),
type: 'JSXAttribute',
name: {
...attrNamePos,
Expand Down Expand Up @@ -713,11 +713,16 @@ runAsWorker(

const expression = handleNode(node)

// keep for debugging
// if (+1 === 1) {
// throw new SyntaxError(JSON.stringify({ node, expression }, null, 2))
// }

if (expression) {
body.push({
...normalizePosition(node.position),
type: 'ExpressionStatement',
expression: handleNode(node) as Expression,
expression: expression as Expression,
})
}

Expand Down
Loading

0 comments on commit 55130c7

Please sign in to comment.