diff --git a/packages/eslint-mdx/src/worker.ts b/packages/eslint-mdx/src/worker.ts
index 69da201..d8160ee 100644
--- a/packages/eslint-mdx/src/worker.ts
+++ b/packages/eslint-mdx/src/worker.ts
@@ -633,7 +633,7 @@ runAsWorker(
}
return {
- ...attrNamePos,
+ ...normalizeNode(attrStart, lastAttrOffset + 1),
type: 'JSXAttribute',
name: {
...attrNamePos,
@@ -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,
})
}
diff --git a/test/__snapshots__/fixtures.test.ts.snap b/test/__snapshots__/fixtures.test.ts.snap
index 17778dc..1d4a3c3 100644
--- a/test/__snapshots__/fixtures.test.ts.snap
+++ b/test/__snapshots__/fixtures.test.ts.snap
@@ -312,7 +312,7 @@ exports[`fixtures should match all snapshots: 292.mdx 1`] = `
},
{
"column": 46,
- "endColumn": 51,
+ "endColumn": 58,
"endLine": 5,
"line": 5,
"message": "Unknown property 'story' found",
@@ -392,10 +392,23 @@ exports[`fixtures should match all snapshots: 380.mdx 1`] = `
"fix": {
"range": [
426,
- 451,
+ 720,
+ ],
+ "text": "decorators={[
+ moduleMetadata({
+ imports: [
+ ButtonModule,
+ IconModule,
+ FormsModule,
+ FormModule,
+ RadioModule,
+ TabsModule,
+ CardModule,
],
- "text": "decorators="Tabs"
- title",
+ declarations: [ActiveTestComponent, LazyTestComponent],
+ }),
+ ]}
+ title="Tabs"",
},
"line": 21,
"message": "Props should be sorted alphabetically",
@@ -411,10 +424,10 @@ exports[`fixtures should match all snapshots: 380.mdx 1`] = `
"fix": {
"range": [
824,
- 847,
+ 855,
],
- "text": "height="Basic"
- name",
+ "text": "height="100px"
+ name="Basic"",
},
"line": 46,
"message": "Props should be sorted alphabetically",
@@ -430,10 +443,10 @@ exports[`fixtures should match all snapshots: 380.mdx 1`] = `
"fix": {
"range": [
1499,
- 1521,
+ 1529,
],
- "text": "height="Card"
- name",
+ "text": "height="200px"
+ name="Card"",
},
"line": 83,
"message": "Props should be sorted alphabetically",
@@ -449,10 +462,10 @@ exports[`fixtures should match all snapshots: 380.mdx 1`] = `
"fix": {
"range": [
1982,
- 2004,
+ 2012,
],
- "text": "height="Size"
- name",
+ "text": "height="200px"
+ name="Size"",
},
"line": 105,
"message": "Props should be sorted alphabetically",
@@ -468,10 +481,10 @@ exports[`fixtures should match all snapshots: 380.mdx 1`] = `
"fix": {
"range": [
2920,
- 2949,
+ 2957,
],
- "text": "height="CustomLabel"
- name",
+ "text": "height="200px"
+ name="CustomLabel"",
},
"line": 139,
"message": "Props should be sorted alphabetically",
@@ -524,10 +537,10 @@ exports[`fixtures should match all snapshots: 380.mdx 1`] = `
"fix": {
"range": [
3750,
- 3776,
+ 3784,
],
- "text": "height="Editable"
- name",
+ "text": "height="100px"
+ name="Editable"",
},
"line": 174,
"message": "Props should be sorted alphabetically",
@@ -640,10 +653,10 @@ exports[`fixtures should match all snapshots: 380.mdx 1`] = `
"fix": {
"range": [
4788,
- 4814,
+ 4822,
],
- "text": "height="Disabled"
- name",
+ "text": "height="100px"
+ name="Disabled"",
},
"line": 220,
"message": "Props should be sorted alphabetically",
@@ -659,10 +672,10 @@ exports[`fixtures should match all snapshots: 380.mdx 1`] = `
"fix": {
"range": [
5581,
- 5603,
+ 5611,
],
- "text": "height="Lazy"
- name",
+ "text": "height="150px"
+ name="Lazy"",
},
"line": 253,
"message": "Props should be sorted alphabetically",
@@ -678,10 +691,10 @@ exports[`fixtures should match all snapshots: 380.mdx 1`] = `
"fix": {
"range": [
6792,
- 6814,
+ 6822,
],
- "text": "height="Nest"
- name",
+ "text": "height="100px"
+ name="Nest"",
},
"line": 299,
"message": "Props should be sorted alphabetically",
@@ -750,10 +763,10 @@ exports[`fixtures should match all snapshots: 380.mdx 1`] = `
"fix": {
"range": [
8233,
- 8256,
+ 8264,
],
- "text": "height="Title"
- name",
+ "text": "height="100px"
+ name="Title"",
},
"line": 348,
"message": "Props should be sorted alphabetically",
@@ -785,8 +798,7 @@ import {
} from '@alauda/ui'
# Tabs
@@ -810,8 +823,8 @@ import {