@samitouri / QOS-React-1 / commits / 501481ccea

Repro for fbt:enum source location issue

Fbt enums appear to rely on source locations and something that we're doing (maybe destructuring?) isn't preserving locations such that the fbt plugin breaks.

Joe Savona committed Mar 19, 2024 at 15:21 UTC 501481ccea2dc1ba844a9f8a926db22a23e1f322
2 files changed +35
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/fbt/error.todo-fbt-unknown-enum-value.expect.md new
+25
@@ -0,0 +1,25 @@
1 +
2 +## Input
3 +
4 +```javascript
5 +import fbt from "fbt";
6 +
7 +function Component({ a, b }) {
8 + return (
9 + <fbt desc="Description">
10 + <fbt:enum enum-range={["avalue1", "avalue1"]} value={a} />{" "}
11 + <fbt:enum enum-range={["bvalue1", "bvalue2"]} value={b} />
12 + </fbt>
13 + );
14 +}
15 +
16 +```
17 +
18 +
19 +## Error
20 +
21 +```
22 +avalue1 not found in { bvalue1: 'bvalue1', bvalue2: 'bvalue2' }. Attempting to re-use incompatible enums
23 +```
24 +
25 +
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/fbt/error.todo-fbt-unknown-enum-value.js new
+10
@@ -0,0 +1,10 @@
1 +import fbt from "fbt";
2 +
3 +function Component({ a, b }) {
4 + return (
5 + <fbt desc="Description">
6 + <fbt:enum enum-range={["avalue1", "avalue1"]} value={a} />{" "}
7 + <fbt:enum enum-range={["bvalue1", "bvalue2"]} value={b} />
8 + </fbt>
9 + );
10 +}