Fix <this.Component /> (#2472)

This is a workaround while waiting on
https://github.com/eslint/typescript-eslint-parser/issues/337.

Fixes #2471
master
John Backus 2017-07-13 00:21:46 -07:00 committed by Lucas Azzola
parent ef91e28434
commit 1691b85322
3 changed files with 8 additions and 0 deletions

View File

@ -1596,6 +1596,11 @@ function genericPrintNoParens(path, options, print, args) {
return concat(parts);
case "JSXIdentifier":
// Can be removed when this is fixed:
// https://github.com/eslint/typescript-eslint-parser/issues/337
if (!n.name) {
return "this";
}
return "" + n.name;
case "JSXNamespacedName":
return join(":", [

View File

@ -46,7 +46,9 @@ const MyCoolThing = ({ thingo }) => <li>{thingo}</li>;
exports[`this.tsx 1`] = `
<this.state.Component />;
<this.Component />;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<this.state.Component />;
<this.Component />;
`;

View File

@ -1 +1,2 @@
<this.state.Component />;
<this.Component />;