Skip to content

Commit 701e2c5

Browse files
soda0289JamesHenry
authored andcommitted
Fix: Set name to type JSXIdentifier and fix selfClosing (fixes eslint#172) (eslint#175)
1 parent 8b4e548 commit 701e2c5

File tree

5 files changed

+1207
-2
lines changed

5 files changed

+1207
-2
lines changed

lib/ast-converter.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -1878,9 +1878,11 @@ module.exports = function(ast, extra) {
18781878
// Convert SyntaxKind.JsxSelfClosingElement to SyntaxKind.JsxOpeningElement,
18791879
// TypeScript does not seem to have the idea of openingElement when tag is self-closing
18801880
node.kind = SyntaxKind.JsxOpeningElement;
1881+
var openingElement = convertChild(node);
1882+
openingElement.selfClosing = true;
18811883
assign(result, {
18821884
type: "JSXElement",
1883-
openingElement: convertChild(node),
1885+
openingElement: openingElement,
18841886
closingElement: null,
18851887
children: []
18861888
});
@@ -1891,7 +1893,7 @@ module.exports = function(ast, extra) {
18911893
var openingTagName = convertTypeScriptJSXTagNameToESTreeName(node.tagName);
18921894
assign(result, {
18931895
type: "JSXOpeningElement",
1894-
selfClosing: !(node.parent && node.parent.closingElement),
1896+
selfClosing: false,
18951897
name: openingTagName,
18961898
attributes: node.attributes.map(convertChild)
18971899
});
@@ -1933,6 +1935,7 @@ module.exports = function(ast, extra) {
19331935

19341936
case SyntaxKind.JsxAttribute:
19351937
var attributeName = convertToken(node.name, ast);
1938+
attributeName.type = "JSXIdentifier";
19361939
attributeName.name = attributeName.value;
19371940
delete attributeName.value;
19381941

0 commit comments

Comments
 (0)