From 8a2281f5cab22c6db19b11384792b86c283cd834 Mon Sep 17 00:00:00 2001 From: JounQin Date: Sun, 10 Dec 2023 01:12:24 +0800 Subject: [PATCH] fix: reproduce #437 --- test/__snapshots__/fixtures.test.ts.snap | 630 ++++++++++++++++++++++- test/__snapshots__/parser.test.ts.snap | 543 +++++++++++++++++++ test/fixtures.test.ts | 4 + test/fixtures/437.mdx | 5 + 4 files changed, 1178 insertions(+), 4 deletions(-) create mode 100644 test/fixtures/437.mdx diff --git a/test/__snapshots__/fixtures.test.ts.snap b/test/__snapshots__/fixtures.test.ts.snap index 8b904b83..1a6b1eef 100644 --- a/test/__snapshots__/fixtures.test.ts.snap +++ b/test/__snapshots__/fixtures.test.ts.snap @@ -137,6 +137,24 @@ import React from 'react' "ruleId": "remark-lint-no-duplicate-headings-in-section", "severity": 1, }, + { + "column": 1, + "endColumn": 9, + "endLine": 46, + "fix": { + "range": [ + 476, + 492, + ], + "text": " />", + }, + "line": 46, + "message": "Empty components are self-closing", + "messageId": "notSelfClosing", + "nodeType": "JSXOpeningElement", + "ruleId": "react/self-closing-comp", + "severity": 2, + }, { "column": 1, "endColumn": 6, @@ -219,10 +237,85 @@ exports[`fixtures lint code blocks should work as expected: code-blocks.mdx 1`] ] `; -exports[`fixtures should match all snapshots: 287.mdx 1`] = `[]`; +exports[`fixtures should match all snapshots: 287.mdx 1`] = ` +[ + { + "column": 50, + "endColumn": 96, + "endLine": 1, + "fix": { + "range": [ + 94, + 111, + ], + "text": " />", + }, + "line": 1, + "message": "Empty components are self-closing", + "messageId": "notSelfClosing", + "nodeType": "JSXOpeningElement", + "ruleId": "react/self-closing-comp", + "severity": 2, + }, + { + "column": 134, + "endColumn": 171, + "endLine": 1, + "fix": { + "range": [ + 169, + 202, + ], + "text": " />", + }, + "line": 1, + "message": "Empty components are self-closing", + "messageId": "notSelfClosing", + "nodeType": "JSXOpeningElement", + "ruleId": "react/self-closing-comp", + "severity": 2, + }, +] +`; exports[`fixtures should match all snapshots: 292.mdx 1`] = ` [ + { + "column": 11, + "endColumn": 32, + "endLine": 3, + "fix": { + "range": [ + 40, + 54, + ], + "text": " />", + }, + "line": 3, + "message": "Empty components are self-closing", + "messageId": "notSelfClosing", + "nodeType": "JSXOpeningElement", + "ruleId": "react/self-closing-comp", + "severity": 2, + }, + { + "column": 5, + "endColumn": 59, + "endLine": 5, + "fix": { + "range": [ + 113, + 146, + ], + "text": " />", + }, + "line": 5, + "message": "Empty components are self-closing", + "messageId": "notSelfClosing", + "nodeType": "JSXOpeningElement", + "ruleId": "react/self-closing-comp", + "severity": 2, + }, { "column": 9, "endColumn": 58, @@ -262,10 +355,85 @@ exports[`fixtures should match all snapshots: 334.mdx 1`] = `[]`; exports[`fixtures should match all snapshots: 336.mdx 1`] = `[]`; -exports[`fixtures should match all snapshots: 367.mdx 1`] = `[]`; +exports[`fixtures should match all snapshots: 367.mdx 1`] = ` +[ + { + "column": 1, + "endColumn": 6, + "endLine": 7, + "fix": { + "range": [ + 49, + 86, + ], + "text": " />", + }, + "line": 7, + "message": "Empty components are self-closing", + "messageId": "notSelfClosing", + "nodeType": "JSXOpeningElement", + "ruleId": "react/self-closing-comp", + "severity": 2, + }, + { + "column": 3, + "endColumn": 6, + "endLine": 8, + "fix": { + "range": [ + 55, + 64, + ], + "text": " />", + }, + "line": 8, + "message": "Empty components are self-closing", + "messageId": "notSelfClosing", + "nodeType": "JSXOpeningElement", + "ruleId": "react/self-closing-comp", + "severity": 2, + }, + { + "column": 3, + "endColumn": 6, + "endLine": 10, + "fix": { + "range": [ + 70, + 79, + ], + "text": " />", + }, + "line": 10, + "message": "Empty components are self-closing", + "messageId": "notSelfClosing", + "nodeType": "JSXOpeningElement", + "ruleId": "react/self-closing-comp", + "severity": 2, + }, +] +`; exports[`fixtures should match all snapshots: 371.mdx 1`] = ` [ + { + "column": 1, + "endColumn": 6, + "endLine": 3, + "fix": { + "range": [ + 21, + 74, + ], + "text": " />", + }, + "line": 3, + "message": "Empty components are self-closing", + "messageId": "notSelfClosing", + "nodeType": "JSXOpeningElement", + "ruleId": "react/self-closing-comp", + "severity": 2, + }, { "column": 13, "endColumn": 14, @@ -497,6 +665,24 @@ exports[`fixtures should match all snapshots: 391.mdx 1`] = ` exports[`fixtures should match all snapshots: 429.mdx 1`] = ` [ + { + "column": 1, + "endColumn": 18, + "endLine": 1, + "fix": { + "range": [ + 16, + 31, + ], + "text": " />", + }, + "line": 1, + "message": "Empty components are self-closing", + "messageId": "notSelfClosing", + "nodeType": "JSXOpeningElement", + "ruleId": "react/self-closing-comp", + "severity": 2, + }, { "column": 17, "endColumn": 17, @@ -520,6 +706,24 @@ exports[`fixtures should match all snapshots: 429.mdx 1`] = ` exports[`fixtures should match all snapshots: 435.mdx 1`] = ` [ + { + "column": 1, + "endColumn": 2, + "endLine": 6, + "fix": { + "range": [ + 70, + 88, + ], + "text": " />", + }, + "line": 1, + "message": "Empty components are self-closing", + "messageId": "notSelfClosing", + "nodeType": "JSXOpeningElement", + "ruleId": "react/self-closing-comp", + "severity": 2, + }, { "column": 1, "endColumn": 2, @@ -680,8 +884,114 @@ exports[`fixtures should match all snapshots: 435.mdx 1`] = ` ] `; +exports[`fixtures should match all snapshots: 437.mdx 1`] = ` +[ + { + "column": 1, + "endColumn": 19, + "endLine": 5, + "fix": { + "range": [ + 65, + 75, + ], + "text": " />", + }, + "line": 5, + "message": "Empty components are self-closing", + "messageId": "notSelfClosing", + "nodeType": "JSXOpeningElement", + "ruleId": "react/self-closing-comp", + "severity": 2, + }, + { + "column": 2, + "endColumn": 5, + "endLine": 5, + "line": 5, + "message": "'App' is not defined.", + "messageId": "undefined", + "nodeType": "JSXIdentifier", + "ruleId": "react/jsx-no-undef", + "severity": 2, + }, + { + "column": 11, + "endColumn": 18, + "endLine": 5, + "fix": { + "range": [ + 58, + 65, + ], + "text": ""foo"", + }, + "line": 5, + "message": "Curly braces are unnecessary here.", + "messageId": "unnecessaryCurly", + "nodeType": "JSXExpressionContainer", + "ruleId": "react/jsx-curly-brace-presence", + "severity": 2, + }, +] +`; + exports[`fixtures should match all snapshots: 445.mdx 1`] = ` [ + { + "column": 1, + "endColumn": 26, + "endLine": 3, + "fix": { + "range": [ + 75, + 155, + ], + "text": " />", + }, + "line": 3, + "message": "Empty components are self-closing", + "messageId": "notSelfClosing", + "nodeType": "JSXOpeningElement", + "ruleId": "react/self-closing-comp", + "severity": 2, + }, + { + "column": 3, + "endColumn": 25, + "endLine": 4, + "fix": { + "range": [ + 100, + 137, + ], + "text": " />", + }, + "line": 4, + "message": "Empty components are self-closing", + "messageId": "notSelfClosing", + "nodeType": "JSXOpeningElement", + "ruleId": "react/self-closing-comp", + "severity": 2, + }, + { + "column": 1, + "endColumn": 8, + "endLine": 9, + "fix": { + "range": [ + 178, + 187, + ], + "text": " />", + }, + "line": 9, + "message": "Empty components are self-closing", + "messageId": "notSelfClosing", + "nodeType": "JSXOpeningElement", + "ruleId": "react/self-closing-comp", + "severity": 2, + }, { "column": 2, "endColumn": 3, @@ -920,6 +1230,42 @@ exports[`fixtures should match all snapshots: basic.mdx 1`] = ` "ruleId": "prettier/prettier", "severity": 2, }, + { + "column": 77, + "endColumn": 80, + "endLine": 9, + "fix": { + "range": [ + 165, + 175, + ], + "text": " />", + }, + "line": 9, + "message": "Empty components are self-closing", + "messageId": "notSelfClosing", + "nodeType": "JSXOpeningElement", + "ruleId": "react/self-closing-comp", + "severity": 2, + }, + { + "column": 1, + "endColumn": 8, + "endLine": 19, + "fix": { + "range": [ + 275, + 309, + ], + "text": " />", + }, + "line": 19, + "message": "Empty components are self-closing", + "messageId": "notSelfClosing", + "nodeType": "JSXOpeningElement", + "ruleId": "react/self-closing-comp", + "severity": 2, + }, ] `; @@ -945,6 +1291,24 @@ exports[`fixtures should match all snapshots: blank-lines.mdx 1`] = ` "ruleId": "prettier/prettier", "severity": 2, }, + { + "column": 1, + "endColumn": 2, + "endLine": 15, + "fix": { + "range": [ + 251, + 546, + ], + "text": " />", + }, + "line": 8, + "message": "Empty components are self-closing", + "messageId": "notSelfClosing", + "nodeType": "JSXOpeningElement", + "ruleId": "react/self-closing-comp", + "severity": 2, + }, { "column": 1, "endColumn": 16, @@ -1010,6 +1374,24 @@ Here's a YouTube shortcode: "ruleId": "react/jsx-no-undef", "severity": 2, }, + { + "column": 1, + "endColumn": 15, + "endLine": 33, + "fix": { + "range": [ + 648, + 703, + ], + "text": " />", + }, + "line": 33, + "message": "Empty components are self-closing", + "messageId": "notSelfClosing", + "nodeType": "JSXOpeningElement", + "ruleId": "react/self-closing-comp", + "severity": 2, + }, { "column": 2, "endColumn": 14, @@ -1168,6 +1550,24 @@ exports[`fixtures should match all snapshots: details.mdx 1`] = ` exports[`fixtures should match all snapshots: jsx-in-list.mdx 1`] = ` [ + { + "column": 5, + "endColumn": 59, + "endLine": 1, + "fix": { + "range": [ + 57, + 90, + ], + "text": " />", + }, + "line": 1, + "message": "Empty components are self-closing", + "messageId": "notSelfClosing", + "nodeType": "JSXOpeningElement", + "ruleId": "react/self-closing-comp", + "severity": 2, + }, { "column": 9, "endColumn": 58, @@ -1200,6 +1600,24 @@ exports[`fixtures should match all snapshots: jsx-in-list.mdx 1`] = ` "ruleId": "react/no-unknown-property", "severity": 2, }, + { + "column": 5, + "endColumn": 59, + "endLine": 5, + "fix": { + "range": [ + 192, + 225, + ], + "text": " />", + }, + "line": 5, + "message": "Empty components are self-closing", + "messageId": "notSelfClosing", + "nodeType": "JSXOpeningElement", + "ruleId": "react/self-closing-comp", + "severity": 2, + }, { "column": 9, "endColumn": 58, @@ -1232,6 +1650,24 @@ exports[`fixtures should match all snapshots: jsx-in-list.mdx 1`] = ` "ruleId": "react/no-unknown-property", "severity": 2, }, + { + "column": 5, + "endColumn": 59, + "endLine": 9, + "fix": { + "range": [ + 327, + 360, + ], + "text": " />", + }, + "line": 9, + "message": "Empty components are self-closing", + "messageId": "notSelfClosing", + "nodeType": "JSXOpeningElement", + "ruleId": "react/self-closing-comp", + "severity": 2, + }, { "column": 9, "endColumn": 58, @@ -1264,6 +1700,24 @@ exports[`fixtures should match all snapshots: jsx-in-list.mdx 1`] = ` "ruleId": "react/no-unknown-property", "severity": 2, }, + { + "column": 5, + "endColumn": 59, + "endLine": 13, + "fix": { + "range": [ + 462, + 495, + ], + "text": " />", + }, + "line": 13, + "message": "Empty components are self-closing", + "messageId": "notSelfClosing", + "nodeType": "JSXOpeningElement", + "ruleId": "react/self-closing-comp", + "severity": 2, + }, { "column": 9, "endColumn": 58, @@ -1296,6 +1750,24 @@ exports[`fixtures should match all snapshots: jsx-in-list.mdx 1`] = ` "ruleId": "react/no-unknown-property", "severity": 2, }, + { + "column": 5, + "endColumn": 59, + "endLine": 17, + "fix": { + "range": [ + 597, + 630, + ], + "text": " />", + }, + "line": 17, + "message": "Empty components are self-closing", + "messageId": "notSelfClosing", + "nodeType": "JSXOpeningElement", + "ruleId": "react/self-closing-comp", + "severity": 2, + }, { "column": 9, "endColumn": 58, @@ -1328,6 +1800,24 @@ exports[`fixtures should match all snapshots: jsx-in-list.mdx 1`] = ` "ruleId": "react/no-unknown-property", "severity": 2, }, + { + "column": 5, + "endColumn": 59, + "endLine": 21, + "fix": { + "range": [ + 732, + 765, + ], + "text": " />", + }, + "line": 21, + "message": "Empty components are self-closing", + "messageId": "notSelfClosing", + "nodeType": "JSXOpeningElement", + "ruleId": "react/self-closing-comp", + "severity": 2, + }, { "column": 9, "endColumn": 58, @@ -1363,13 +1853,145 @@ exports[`fixtures should match all snapshots: jsx-in-list.mdx 1`] = ` ] `; -exports[`fixtures should match all snapshots: leading-spaces.mdx 1`] = `[]`; +exports[`fixtures should match all snapshots: leading-spaces.mdx 1`] = ` +[ + { + "column": 1, + "endColumn": 6, + "endLine": 1, + "fix": { + "range": [ + 4, + 41, + ], + "text": " />", + }, + "line": 1, + "message": "Empty components are self-closing", + "messageId": "notSelfClosing", + "nodeType": "JSXOpeningElement", + "ruleId": "react/self-closing-comp", + "severity": 2, + }, + { + "column": 3, + "endColumn": 6, + "endLine": 2, + "fix": { + "range": [ + 10, + 19, + ], + "text": " />", + }, + "line": 2, + "message": "Empty components are self-closing", + "messageId": "notSelfClosing", + "nodeType": "JSXOpeningElement", + "ruleId": "react/self-closing-comp", + "severity": 2, + }, + { + "column": 3, + "endColumn": 6, + "endLine": 4, + "fix": { + "range": [ + 25, + 34, + ], + "text": " />", + }, + "line": 4, + "message": "Empty components are self-closing", + "messageId": "notSelfClosing", + "nodeType": "JSXOpeningElement", + "ruleId": "react/self-closing-comp", + "severity": 2, + }, +] +`; exports[`fixtures should match all snapshots: markdown.md 1`] = `[]`; exports[`fixtures should match all snapshots: nested.md 1`] = `[]`; -exports[`fixtures should match all snapshots: no-unescaped-entities.mdx 1`] = `[]`; +exports[`fixtures should match all snapshots: no-unescaped-entities.mdx 1`] = ` +[ + { + "column": 1, + "endColumn": 9, + "endLine": 1, + "fix": { + "range": [ + 7, + 25, + ], + "text": " />", + }, + "line": 1, + "message": "Empty components are self-closing", + "messageId": "notSelfClosing", + "nodeType": "JSXOpeningElement", + "ruleId": "react/self-closing-comp", + "severity": 2, + }, + { + "column": 1, + "endColumn": 7, + "endLine": 2, + "fix": { + "range": [ + 31, + 42, + ], + "text": " />", + }, + "line": 2, + "message": "Empty components are self-closing", + "messageId": "notSelfClosing", + "nodeType": "JSXOpeningElement", + "ruleId": "react/self-closing-comp", + "severity": 2, + }, + { + "column": 8, + "endColumn": 16, + "endLine": 4, + "fix": { + "range": [ + 58, + 76, + ], + "text": " />", + }, + "line": 4, + "message": "Empty components are self-closing", + "messageId": "notSelfClosing", + "nodeType": "JSXOpeningElement", + "ruleId": "react/self-closing-comp", + "severity": 2, + }, + { + "column": 6, + "endColumn": 12, + "endLine": 5, + "fix": { + "range": [ + 87, + 98, + ], + "text": " />", + }, + "line": 5, + "message": "Empty components are self-closing", + "messageId": "notSelfClosing", + "nodeType": "JSXOpeningElement", + "ruleId": "react/self-closing-comp", + "severity": 2, + }, +] +`; exports[`fixtures should match all snapshots: no-unused-expressions.mdx 1`] = ` [ diff --git a/test/__snapshots__/parser.test.ts.snap b/test/__snapshots__/parser.test.ts.snap index f76c8068..d1375444 100644 --- a/test/__snapshots__/parser.test.ts.snap +++ b/test/__snapshots__/parser.test.ts.snap @@ -31409,6 +31409,549 @@ exports[`parser should match all AST snapshots: 435.mdx 1`] = ` } `; +exports[`parser should match all AST snapshots: 437.mdx 1`] = ` +{ + "body": [ + { + "end": 75, + "expression": { + "children": [], + "closingElement": { + "end": 75, + "loc": { + "end": { + "column": 27, + "line": 5, + "offset": 75, + }, + "start": { + "column": 21, + "line": 5, + "offset": 69, + }, + }, + "name": { + "end": 74, + "loc": { + "end": { + "column": 26, + "line": 5, + "offset": 74, + }, + "start": { + "column": 23, + "line": 5, + "offset": 71, + }, + }, + "name": "App", + "range": [ + 71, + 74, + ], + "raw": "App", + "start": 71, + "type": "JSXIdentifier", + }, + "range": [ + 69, + 75, + ], + "raw": "", + "start": 69, + "type": "JSXClosingElement", + }, + "end": 75, + "loc": { + "end": { + "column": 27, + "line": 5, + "offset": 75, + }, + "start": { + "column": 0, + "line": 5, + "offset": 48, + }, + }, + "openingElement": { + "attributes": [ + { + "end": 57, + "loc": { + "end": { + "column": 9, + "line": 5, + "offset": 57, + }, + "start": { + "column": 5, + "line": 5, + "offset": 53, + }, + }, + "name": { + "end": 57, + "loc": { + "end": { + "column": 9, + "line": 5, + "offset": 57, + }, + "start": { + "column": 5, + "line": 5, + "offset": 53, + }, + }, + "name": "prop", + "range": [ + 53, + 57, + ], + "raw": "prop", + "start": 53, + "type": "JSXIdentifier", + }, + "range": [ + 53, + 57, + ], + "raw": "prop", + "start": 53, + "type": "JSXAttribute", + "value": { + "end": 65, + "expression": { + "end": 64, + "loc": { + "end": { + "column": 16, + "line": 5, + "offset": 64, + }, + "start": { + "column": 11, + "line": 5, + "offset": 59, + }, + }, + "range": [ + 59, + 64, + ], + "raw": "'foo'", + "start": 59, + "type": "Literal", + "value": "foo", + }, + "loc": { + "end": { + "column": 17, + "line": 5, + "offset": 65, + }, + "start": { + "column": 10, + "line": 5, + "offset": 58, + }, + }, + "range": [ + 58, + 65, + ], + "raw": "{'foo'}", + "start": 58, + "type": "JSXExpressionContainer", + }, + }, + ], + "end": 66, + "loc": { + "end": { + "column": 18, + "line": 5, + "offset": 66, + }, + "start": { + "column": 0, + "line": 5, + "offset": 48, + }, + }, + "name": { + "end": 52, + "loc": { + "end": { + "column": 4, + "line": 5, + "offset": 52, + }, + "start": { + "column": 1, + "line": 5, + "offset": 49, + }, + }, + "name": "App", + "range": [ + 49, + 52, + ], + "raw": "App", + "start": 49, + "type": "JSXIdentifier", + }, + "range": [ + 48, + 66, + ], + "raw": "", + "selfClosing": false, + "start": 48, + "type": "JSXOpeningElement", + }, + "range": [ + 48, + 75, + ], + "raw": "bar", + "start": 48, + "type": "JSXElement", + }, + "loc": { + "end": { + "column": 28, + "line": 5, + "offset": 75, + }, + "start": { + "column": 1, + "line": 5, + "offset": 48, + }, + }, + "range": [ + 48, + 75, + ], + "start": 48, + "type": "ExpressionStatement", + }, + ], + "comments": [], + "end": 76, + "loc": { + "end": { + "column": 1, + "line": 6, + "offset": 76, + }, + "start": { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "range": [ + 0, + 76, + ], + "sourceType": undefined, + "start": 0, + "tokens": [ + { + "end": 49, + "loc": { + "end": { + "column": 1, + "line": 5, + "offset": 49, + }, + "start": { + "column": 0, + "line": 5, + "offset": 48, + }, + }, + "range": [ + 48, + 49, + ], + "start": 48, + "type": "Punctuator", + "value": "<", + }, + { + "end": 52, + "loc": { + "end": { + "column": 4, + "line": 5, + "offset": 52, + }, + "start": { + "column": 1, + "line": 5, + "offset": 49, + }, + }, + "range": [ + 49, + 52, + ], + "start": 49, + "type": "JSXIdentifier", + "value": "App", + }, + { + "end": 57, + "loc": { + "end": { + "column": 9, + "line": 5, + "offset": 57, + }, + "start": { + "column": 5, + "line": 5, + "offset": 53, + }, + }, + "range": [ + 53, + 57, + ], + "start": 53, + "type": "JSXIdentifier", + "value": "prop", + }, + { + "end": 58, + "loc": { + "end": { + "column": 10, + "line": 5, + "offset": 58, + }, + "start": { + "column": 9, + "line": 5, + "offset": 57, + }, + }, + "range": [ + 57, + 58, + ], + "start": 57, + "type": "Punctuator", + "value": "=", + }, + { + "end": 59, + "loc": { + "end": { + "column": 11, + "line": 5, + "offset": 59, + }, + "start": { + "column": 10, + "line": 5, + "offset": 58, + }, + }, + "range": [ + 58, + 59, + ], + "start": 58, + "type": "Punctuator", + "value": "{", + }, + { + "end": 64, + "loc": { + "end": { + "column": 16, + "line": 5, + "offset": 64, + }, + "start": { + "column": 11, + "line": 5, + "offset": 59, + }, + }, + "range": [ + 59, + 64, + ], + "start": 59, + "type": "String", + "value": "'foo'", + }, + { + "end": 64, + "loc": { + "end": { + "column": 16, + "line": 5, + "offset": 64, + }, + "start": { + "column": 11, + "line": 5, + "offset": 59, + }, + }, + "range": [ + 59, + 64, + ], + "start": 59, + "type": "String", + "value": "'foo'", + }, + { + "end": 65, + "loc": { + "end": { + "column": 17, + "line": 5, + "offset": 65, + }, + "start": { + "column": 16, + "line": 5, + "offset": 64, + }, + }, + "range": [ + 64, + 65, + ], + "start": 64, + "type": "Punctuator", + "value": "}", + }, + { + "end": 69, + "loc": { + "end": { + "column": 21, + "line": 5, + "offset": 69, + }, + "start": { + "column": 18, + "line": 5, + "offset": 66, + }, + }, + "range": [ + 66, + 69, + ], + "start": 66, + "type": "JSXText", + "value": "bar", + }, + { + "end": 70, + "loc": { + "end": { + "column": 22, + "line": 5, + "offset": 70, + }, + "start": { + "column": 21, + "line": 5, + "offset": 69, + }, + }, + "range": [ + 69, + 70, + ], + "start": 69, + "type": "Punctuator", + "value": "<", + }, + { + "end": 71, + "loc": { + "end": { + "column": 23, + "line": 5, + "offset": 71, + }, + "start": { + "column": 22, + "line": 5, + "offset": 70, + }, + }, + "range": [ + 70, + 71, + ], + "start": 70, + "type": "Punctuator", + "value": "/", + }, + { + "end": 74, + "loc": { + "end": { + "column": 26, + "line": 5, + "offset": 74, + }, + "start": { + "column": 23, + "line": 5, + "offset": 71, + }, + }, + "range": [ + 71, + 74, + ], + "start": 71, + "type": "JSXIdentifier", + "value": "App", + }, + { + "end": 75, + "loc": { + "end": { + "column": 27, + "line": 5, + "offset": 75, + }, + "start": { + "column": 26, + "line": 5, + "offset": 74, + }, + }, + "range": [ + 74, + 75, + ], + "start": 74, + "type": "Punctuator", + "value": ">", + }, + ], + "type": "Program", +} +`; + exports[`parser should match all AST snapshots: 445.mdx 1`] = ` { "body": [ diff --git a/test/fixtures.test.ts b/test/fixtures.test.ts index 35b61a01..99017625 100644 --- a/test/fixtures.test.ts +++ b/test/fixtures.test.ts @@ -26,6 +26,10 @@ const getCli = (lintCodeBlocks = false) => version: 'detect', }, }, + rules: { + 'react/jsx-curly-brace-presence': 'error', + 'react/self-closing-comp': 'error', + }, overrides: lintCodeBlocks ? [ { diff --git a/test/fixtures/437.mdx b/test/fixtures/437.mdx new file mode 100644 index 00000000..1b4d7baa --- /dev/null +++ b/test/fixtures/437.mdx @@ -0,0 +1,5 @@ +```jsx +let a = bar +``` + +bar