diff --git a/src/printer.js b/src/printer.js index a57768a9..d28ab891 100644 --- a/src/printer.js +++ b/src/printer.js @@ -1510,12 +1510,9 @@ 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/257 - if (n.object && n.property) { - return join(".", [ - path.call(print, "object"), - path.call(print, "property") - ]); + // https://github.com/eslint/typescript-eslint-parser/issues/307 + if (!n.name) { + return "this"; } return "" + n.name; case "JSXNamespacedName": diff --git a/tests/typescript_tsx/__snapshots__/jsfmt.spec.js.snap b/tests/typescript_tsx/__snapshots__/jsfmt.spec.js.snap index 18af0d59..dcb1db90 100644 --- a/tests/typescript_tsx/__snapshots__/jsfmt.spec.js.snap +++ b/tests/typescript_tsx/__snapshots__/jsfmt.spec.js.snap @@ -37,3 +37,10 @@ const MyCoolList = ({ things }) => const MyCoolThing = ({ thingo }) =>
  • {thingo}
  • ; `; + +exports[`this.tsx 1`] = ` +; +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +; + +`; diff --git a/tests/typescript_tsx/this.tsx b/tests/typescript_tsx/this.tsx new file mode 100644 index 00000000..f3bd61bc --- /dev/null +++ b/tests/typescript_tsx/this.tsx @@ -0,0 +1 @@ +;