Don't treat JSXIdentifier in JSXMemberExpression as HTML tag. Closes #4027 (#4765)

This commit is contained in:
Andrew Levine
2016-10-24 09:42:50 -05:00
committed by Henry Zhu
parent de46827be7
commit 555ee0cb51
4 changed files with 23 additions and 1 deletions

View File

@@ -0,0 +1,6 @@
//index.js file
import { form } from "./export";
function ParentComponent() {
return <form.TestComponent />;
}

View File

@@ -0,0 +1,7 @@
"use strict";
var _export = require("./export");
function ParentComponent() {
return babelHelpers.jsx(_export.form.TestComponent, {});
} //index.js file

View File

@@ -0,0 +1,9 @@
{
"plugins": [
"external-helpers",
"syntax-jsx",
"transform-react-inline-elements",
"transform-react-jsx",
"transform-es2015-modules-commonjs"
]
}

View File

@@ -5,7 +5,7 @@ import * as t from "babel-types";
export let ReferencedIdentifier = {
types: ["Identifier", "JSXIdentifier"],
checkPath({ node, parent }: NodePath, opts?: Object): boolean {
if (!t.isIdentifier(node, opts)) {
if (!t.isIdentifier(node, opts) && !t.isJSXMemberExpression(parent, opts)) {
if (t.isJSXIdentifier(node, opts)) {
if (react.isCompatTag(node.name)) return false;
} else {