@samitouri / QOS-React-2 / commits / bf64a826a4

Repro for fbt with unexpected child count

Joe Savona committed Mar 13, 2024 at 14:54 UTC bf64a826a4881d9ee25500e7cdab416797e12aab
2 files changed +41
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.todo-fbt-with-additional-whitespace-child.expect.md new
+31
@@ -0,0 +1,31 @@
1 +
2 +## Input
3 +
4 +```javascript
5 +function Component(props) {
6 + return (
7 + <fbt desc="Title">
8 + <fbt:plural count={identity(props.count)} name="count" showCount="yes">
9 + vote
10 + </fbt:plural>{" "}
11 + for <fbt:param name="option">{props.option} </fbt:param>
12 + </fbt>
13 + );
14 +}
15 +
16 +```
17 +
18 +
19 +## Error
20 +
21 +```
22 + 5 | vote
23 + 6 | </fbt:plural>{" "}
24 +> 7 | for <fbt:param name="option">{props.option} </fbt:param>
25 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [ReactForget] Invariant: Expected fbt element to have 3 children (whitespace, content, whitespace) or 1 (content) (7:7)
26 + 8 | </fbt>
27 + 9 | );
28 + 10 | }
29 +```
30 +
31 +
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.todo-fbt-with-additional-whitespace-child.js new
+10
@@ -0,0 +1,10 @@
1 +function Component(props) {
2 + return (
3 + <fbt desc="Title">
4 + <fbt:plural count={identity(props.count)} name="count" showCount="yes">
5 + vote
6 + </fbt:plural>{" "}
7 + for <fbt:param name="option">{props.option} </fbt:param>
8 + </fbt>
9 + );
10 +}