Repository: lingui/js-lingui (ts)

Issue:
Support comments inside JSX macros by ignoring empty jsx expressions
**Describe the bug**
When using a `<Trans>` element with a nested element like `{/* This is a comment */}`, it complains of @lingui/macro: Property value of ObjectProperty expected node to be of a type ["Expression","PatternLike"] but instead got "JSXEmptyExpression" Learn more: https://www.npmjs.com/package/@lingui/macro

**To Reproduce**
Steps to reproduce the behavior, possibly with minimal code sample, e.g:

```
import { Trans } from "@lingui/macro"

export default function App() {
   return (<Trans>
    {/* TODO: Come up with a better translation than this */}
    This should be translated!
  </Trans>)
}
```

**Expected behavior**
The comment should be ignored completely, leaving just the "This should be translated!" text.

**Additional context**
Add any other context about the problem here.

- jsLingui version ``2.9.1``
- Babel version ``babel-core@7.0.0-bridge.0``
- Your Babel config (e.g. `.babelrc`) or framework you use (Create React App, Meteor, etc.): Create React App


Pull request description:
fix: Support comments inside JSX macros by ignoring empty jsx expressions
- this adds explicit handling of JSXEmptyExpression within
  packages/macro/src/icu.ts, where the token is skipped over entirely
- Fixes #684

Patch:
diff --git a/packages/macro/src/icu.ts b/packages/macro/src/icu.ts
index cd39161a..04f478d3 100644
--- a/packages/macro/src/icu.ts
+++ b/packages/macro/src/icu.ts
@@ -7,6 +7,7 @@ export default function ICUMessageFormat() {}
 ICUMessageFormat.prototype.fromTokens = function (tokens) {
   return (Array.isArray(tokens) ? tokens : [tokens])
     .map((token) => this.processToken(token))
+    .filter(Boolean)
     .reduce(
       (props, message) => ({
         ...message,
@@ -30,6 +31,9 @@ ICUMessageFormat.prototype.processToken = function (token) {
       message: token.value,
     }
   } else if (token.type === "arg") {
+    if (token.value !== undefined && token.value.type === 'JSXEmptyExpression') {
+      return null;
+    }
     const values =
       token.value !== undefined
         ? {


Test patch:
diff --git a/packages/macro/test/jsx-trans.ts b/packages/macro/test/jsx-trans.ts
index ed96062c..78a82576 100644
--- a/packages/macro/test/jsx-trans.ts
+++ b/packages/macro/test/jsx-trans.ts
@@ -311,4 +311,15 @@ export default [
         }>About</a>;
       `,
   },
+  {
+    name: "Ignore JSXEmptyExpression",
+    input: `
+        import { Trans } from '@lingui/macro';
+        <Trans>Hello {/* and I cannot stress this enough */} World</Trans>;
+      `,
+    expected: `
+        import { Trans } from "@lingui/react";
+        <Trans id="Hello  World" />;
+      `,
+  },
 ]