@ripple-ts/prettier-plugin 0.2.215 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/package.json +3 -4
  2. package/src/index.js +620 -629
  3. package/src/index.test.js +168 -58
package/src/index.test.js CHANGED
@@ -655,7 +655,7 @@ import { Something, type Props, track } from 'ripple';`;
655
655
  it('should handle @ prefix', async () => {
656
656
  const input = `export default component App() {
657
657
  <div>
658
- let count = track(0);
658
+ let count = #ripple.track(0);
659
659
  @count = 2;
660
660
  console.log(@count);
661
661
  console.log(count);
@@ -666,7 +666,7 @@ import { Something, type Props, track } from 'ripple';`;
666
666
  }`;
667
667
  const expected = `export default component App() {
668
668
  <div>
669
- let count = track(0);
669
+ let count = #ripple.track(0);
670
670
  @count = 2;
671
671
  console.log(@count);
672
672
  console.log(count);
@@ -708,14 +708,14 @@ import { Something, type Props, track } from 'ripple';`;
708
708
 
709
709
  it('should preserve @ symbol in JSX attributes and shorthand syntax', async () => {
710
710
  const input = `component App() {
711
- const count = track(0);
711
+ const count = #ripple.track(0);
712
712
 
713
713
  <Counter count={@count} />
714
714
  <Counter {@count} />
715
715
  }`;
716
716
 
717
717
  const expected = `component App() {
718
- const count = track(0);
718
+ const count = #ripple.track(0);
719
719
 
720
720
  <Counter {@count} />
721
721
  <Counter {@count} />
@@ -935,7 +935,7 @@ export component Test({ a, b }: Props) {}`;
935
935
 
936
936
  it('should not strip @ from dynamic @tag', async () => {
937
937
  const expected = `export component Four() {
938
- let tag = track('div');
938
+ let tag = #ripple.track('div');
939
939
 
940
940
  <@tag {href} {...props}>
941
941
  <@children />
@@ -963,7 +963,7 @@ export component Test({ a, b }: Props) {}`;
963
963
 
964
964
  it('should not strip @ from dynamic self-closing components', async () => {
965
965
  const expected = `component App() {
966
- <@tracked_object.@tracked_basic />
966
+ <@ripple_object.@tracked_basic />
967
967
  }`;
968
968
 
969
969
  const result = await format(expected, { singleQuote: true, printWidth: 100 });
@@ -973,7 +973,7 @@ export component Test({ a, b }: Props) {}`;
973
973
  it('should keep @ on dynamic object member array expressions', async () => {
974
974
  const expected = `component App() {
975
975
  const obj = {
976
- [0]: track(0),
976
+ [0]: #ripple.track(0),
977
977
  };
978
978
 
979
979
  <div>{obj.@[0]}</div>
@@ -1263,17 +1263,17 @@ const [obj1, obj2] = arrayOfObjects;`;
1263
1263
  expect(result).toBeWithNewline(expected);
1264
1264
  });
1265
1265
 
1266
- it('should keep TrackedMap short syntax intact', async () => {
1267
- const expected = `const map = new #Map([['key1', 'value1'], ['key2', 'value2']]);
1268
- const set = new #Set([1, 2, 3]);`;
1266
+ it('should keep RippleMap short syntax intact', async () => {
1267
+ const expected = `const map = #ripple.map([['key1', 'value1'], ['key2', 'value2']]);
1268
+ const set = #ripple.set([1, 2, 3]);`;
1269
1269
 
1270
1270
  const result = await format(expected, { singleQuote: true, printWidth: 100 });
1271
1271
  expect(result).toBeWithNewline(expected);
1272
1272
  });
1273
1273
 
1274
- it('should keep TrackedSet parents with short syntax and no args intact', async () => {
1274
+ it('should keep RippleSet parents with short syntax and no args intact', async () => {
1275
1275
  const expected = `component SetTest() {
1276
- let items = new #Set();
1276
+ let items = #ripple.set();
1277
1277
 
1278
1278
  <button onClick={() => items.add(1)}>{'add'}</button>
1279
1279
  <pre>{items.size}</pre>
@@ -1283,13 +1283,53 @@ const set = new #Set([1, 2, 3]);`;
1283
1283
  expect(result).toBeWithNewline(expected);
1284
1284
  });
1285
1285
 
1286
- it('should keep TrackedMap parents with short syntax and no args intact', async () => {
1286
+ it('should keep RippleMap parents with short syntax and no args intact', async () => {
1287
1287
  const expected = `component MapTest() {
1288
- let items = new #Map();
1288
+ let items = #ripple.map();
1289
1289
 
1290
1290
  <button onClick={() => items.set('key', 1)}>{'add'}</button>
1291
1291
  <pre>{items.size}</pre>
1292
1292
  }`;
1293
+ const result = await format(expected, { singleQuote: true, printWidth: 100 });
1294
+ expect(result).toBeWithNewline(expected);
1295
+ });
1296
+
1297
+ it('should preserve #ripple.array and #ripple.object long syntax if authored', async () => {
1298
+ const input = `component App() {
1299
+ let arr = #ripple.array(1, 2, 3);
1300
+ let obj = #ripple.object({ a: 1 });
1301
+
1302
+ <div>{arr.length + obj.a}</div>
1303
+ }`;
1304
+
1305
+ const expected = `component App() {
1306
+ let arr = #ripple.array(1, 2, 3);
1307
+ let obj = #ripple.object({ a: 1 });
1308
+
1309
+ <div>{arr.length + obj.a}</div>
1310
+ }`;
1311
+
1312
+ const result = await format(input, { singleQuote: true, printWidth: 100 });
1313
+ expect(result).toBeWithNewline(expected);
1314
+ });
1315
+
1316
+ it('should preserve static member access from #ripple collection roots', async () => {
1317
+ const input = `const from = #ripple.array.from([1, 2, 3]);
1318
+ const from_async = #ripple.array.fromAsync([1, 2, 3]);
1319
+ const of = #ripple.array
1320
+ .of(1, 2, 3);`;
1321
+
1322
+ const expected = `const from = #ripple.array.from([1, 2, 3]);
1323
+ const from_async = #ripple.array.fromAsync([1, 2, 3]);
1324
+ const of = #ripple.array.of(1, 2, 3);`;
1325
+
1326
+ const result = await format(input, { singleQuote: true, printWidth: 100 });
1327
+ expect(result).toBeWithNewline(expected);
1328
+ });
1329
+
1330
+ it('should preserve computed member access from #ripple roots', async () => {
1331
+ const expected = `const from = #ripple.array['from']([1, 2, 3]);
1332
+ const of = #ripple.array['of'](1, 2, 3);`;
1293
1333
 
1294
1334
  const result = await format(expected, { singleQuote: true, printWidth: 100 });
1295
1335
  expect(result).toBeWithNewline(expected);
@@ -1406,7 +1446,7 @@ import { GetRootNode } from './somewhere';`;
1406
1446
  });
1407
1447
 
1408
1448
  it('should preserve export interface with extends as provided', async () => {
1409
- const expected = `export interface TrackedArray<T> extends Array<T> {}`;
1449
+ const expected = `export interface RippleArray<T> extends Array<T> {}`;
1410
1450
 
1411
1451
  const result = await format(expected, { singleQuote: true, printWidth: 100 });
1412
1452
  expect(result).toBeWithNewline(expected);
@@ -1418,7 +1458,7 @@ import { GetRootNode } from './somewhere';`;
1418
1458
  * @param {'contentRect' | 'contentBoxSize' | 'borderBoxSize' | 'devicePixelContentBoxSize'} type
1419
1459
  */
1420
1460
  function bind_element_rect(maybe_tracked, type) {
1421
- if (!is_tracked_object(maybe_tracked)) {
1461
+ if (!is_ripple_object(maybe_tracked)) {
1422
1462
  throw not_tracked_type_error(\`bind\${type.charAt(0).toUpperCase() + type.slice(1)}()\`);
1423
1463
  }
1424
1464
 
@@ -1436,7 +1476,7 @@ function bind_element_rect(maybe_tracked, type) {
1436
1476
  /** @param {any} entry */ (entry) => set(tracked, entry[type]),
1437
1477
  );
1438
1478
 
1439
- effect(() => unsubscribe);
1479
+ #ripple.effect(() => unsubscribe);
1440
1480
  };
1441
1481
  }`;
1442
1482
 
@@ -1690,8 +1730,8 @@ const program =
1690
1730
  it('should keep blank lines between commented out block and markup', async () => {
1691
1731
  const expected = `function CounterWrapper(props) {
1692
1732
  const more = {
1693
- double: track(() => props.count * 2),
1694
- another: track(0),
1733
+ double: #ripple.track(() => props.count * 2),
1734
+ another: #ripple.track(0),
1695
1735
  onemore: 100,
1696
1736
  };
1697
1737
 
@@ -1709,24 +1749,24 @@ const program =
1709
1749
  });
1710
1750
 
1711
1751
  it('should keep parens around negating key in object expression', async () => {
1712
- const input = `effect(() => {
1752
+ const input = `#ripple.effect(() => {
1713
1753
  props.count;
1714
1754
  if (props.count > 1 && 'another' in more) {
1715
- untrack(() => delete more.another);
1755
+ #ripple.untrack(() => delete more.another);
1716
1756
  } else if (props.count > 2 && !('another' in more)) {
1717
- untrack(() => more.another = 0);
1757
+ #ripple.untrack(() => more.another = 0);
1718
1758
  }
1719
- untrack(() => console.log(more));
1759
+ #ripple.untrack(() => console.log(more));
1720
1760
  });`;
1721
1761
 
1722
- const expected = `effect(() => {
1762
+ const expected = `#ripple.effect(() => {
1723
1763
  props.count;
1724
1764
  if (props.count > 1 && 'another' in more) {
1725
- untrack(() => delete more.another);
1765
+ #ripple.untrack(() => delete more.another);
1726
1766
  } else if (props.count > 2 && !('another' in more)) {
1727
- untrack(() => (more.another = 0));
1767
+ #ripple.untrack(() => (more.another = 0));
1728
1768
  }
1729
- untrack(() => console.log(more));
1769
+ #ripple.untrack(() => console.log(more));
1730
1770
  });`;
1731
1771
 
1732
1772
  const result = await format(input, { singleQuote: true, printWidth: 100 });
@@ -1734,7 +1774,7 @@ const program =
1734
1774
  });
1735
1775
 
1736
1776
  it('should keep parents in math subtraction and multiplication', async () => {
1737
- const expected = `let offset = track(() => (@page - 1) * @limit);`;
1777
+ const expected = `let offset = #ripple.track(() => (@page - 1) * @limit);`;
1738
1778
 
1739
1779
  const result = await format(expected, { singleQuote: true, printWidth: 100 });
1740
1780
  expect(result).toBeWithNewline(expected);
@@ -1750,6 +1790,31 @@ files = [...(files ?? []), ...dt.files];`;
1750
1790
  expect(result).toBeWithNewline(expected);
1751
1791
  });
1752
1792
 
1793
+ it('should not double-parenthesize a parenthesized identifier callee', async () => {
1794
+ const expected = `const s = (foo)();`;
1795
+
1796
+ const result = await format(expected, { singleQuote: true, printWidth: 80 });
1797
+ expect(result).toBeWithNewline(expected);
1798
+ });
1799
+
1800
+ it('should preserve parentheses around IIFE arrow function callee', async () => {
1801
+ const expected = `const s = (() => {
1802
+ return true;
1803
+ })();`;
1804
+
1805
+ const result = await format(expected, { singleQuote: true, printWidth: 80 });
1806
+ expect(result).toBeWithNewline(expected);
1807
+ });
1808
+
1809
+ it('should preserve parentheses around IIFE function expression callee', async () => {
1810
+ const expected = `const s = (function () {
1811
+ return true;
1812
+ })();`;
1813
+
1814
+ const result = await format(expected, { singleQuote: true, printWidth: 80 });
1815
+ expect(result).toBeWithNewline(expected);
1816
+ });
1817
+
1753
1818
  it('should recognize and preserve class assignments to variables', async () => {
1754
1819
  const expected = `let test = class MediaQueryList {};`;
1755
1820
 
@@ -1784,7 +1849,7 @@ files = [...(files ?? []), ...dt.files];`;
1784
1849
 
1785
1850
  it('should preserve the order of try / pending / catch block', async () => {
1786
1851
  const expected = `component Test() {
1787
- let items: TrackedArray<string> | null = null;
1852
+ let items: RippleArray<string> | null = null;
1788
1853
  let error: string | null = null;
1789
1854
 
1790
1855
  async function* throwingIterable() {
@@ -1792,7 +1857,7 @@ files = [...(files ?? []), ...dt.files];`;
1792
1857
  }
1793
1858
 
1794
1859
  try {
1795
- items = await TrackedArray.fromAsync(throwingIterable());
1860
+ items = await #ripple.array.fromAsync(throwingIterable());
1796
1861
  for (const item of items) {
1797
1862
  <li>{item}</li>
1798
1863
  }
@@ -2209,6 +2274,22 @@ component Child({ something }) {
2209
2274
  const result = await format(expected);
2210
2275
  expect(result).toBeWithNewline(expected);
2211
2276
  });
2277
+
2278
+ it('prints function with a rest parameter correctly', async () => {
2279
+ const expected = `function TestRest(...args: string[]) {
2280
+ console.log(args);
2281
+ }`;
2282
+
2283
+ const result = await format(expected);
2284
+ expect(result).toBeWithNewline(expected);
2285
+ });
2286
+
2287
+ it('keeps parens around as ts expression and optional calling', async () => {
2288
+ const expected = `(resolve_fn as () => void)?.();`;
2289
+
2290
+ const result = await format(expected);
2291
+ expect(result).toBeWithNewline(expected);
2292
+ });
2212
2293
  });
2213
2294
 
2214
2295
  describe('edge cases', () => {
@@ -2252,7 +2333,7 @@ component Child({ something }) {
2252
2333
 
2253
2334
  it('should correctly handle call expressions', async () => {
2254
2335
  const input = `export component App() {
2255
- const context = track(globalContext.get().theme);
2336
+ const context = #ripple.track(globalContext.get().theme);
2256
2337
  <div>
2257
2338
  <TypedComponent />
2258
2339
  {@context}
@@ -2260,7 +2341,7 @@ component Child({ something }) {
2260
2341
  }`;
2261
2342
 
2262
2343
  const expected = `export component App() {
2263
- const context = track(globalContext.get().theme);
2344
+ const context = #ripple.track(globalContext.get().theme);
2264
2345
  <div>
2265
2346
  <TypedComponent />
2266
2347
  {@context}
@@ -2545,7 +2626,7 @@ function test() {
2545
2626
  // comment 3
2546
2627
  };
2547
2628
 
2548
- const obj2 = #{
2629
+ const obj2 = #ripple{
2549
2630
  /* comment 1 */
2550
2631
  a: 1,
2551
2632
 
@@ -2691,7 +2772,7 @@ const obj2 = #{
2691
2772
  });
2692
2773
 
2693
2774
  it('should preserve comments in arrays width printWidth 3', async () => {
2694
- const input = `const arr = #[
2775
+ const input = `const arr = #ripple[
2695
2776
  1,
2696
2777
  /* comment 1 */
2697
2778
  2,
@@ -2700,7 +2781,7 @@ const obj2 = #{
2700
2781
  ];`;
2701
2782
 
2702
2783
  const expected = `const arr =
2703
- #[
2784
+ #ripple[
2704
2785
  1,
2705
2786
  /* comment 1 */
2706
2787
  2,
@@ -2714,13 +2795,13 @@ const obj2 = #{
2714
2795
 
2715
2796
  it('should preserve comments in arrays width printWidth 13', async () => {
2716
2797
  const input = `const arr =
2717
- #[
2798
+ #ripple[
2718
2799
  1 /* comment 1 */,
2719
2800
  2, 3,
2720
2801
  // comment 2
2721
2802
  ];`;
2722
2803
 
2723
- const expected = `const arr = #[
2804
+ const expected = `const arr = #ripple[
2724
2805
  1 /* comment 1 */,
2725
2806
  2, 3,
2726
2807
  // comment 2
@@ -3120,14 +3201,14 @@ const items = [] as unknown[];`;
3120
3201
 
3121
3202
  it('should format TypeScript generics in variable declarations', async () => {
3122
3203
  const input = `component GenericTest() {
3123
- let open: Tracked<boolean> = track(false);
3204
+ let open: Tracked<boolean> = #ripple.track(false);
3124
3205
  let items: Array<string> = [];
3125
3206
  let map: Map<string, number> = new Map();
3126
3207
  <div>{"test"}</div>
3127
3208
  }`;
3128
3209
 
3129
3210
  const expected = `component GenericTest() {
3130
- let open: Tracked<boolean> = track(false);
3211
+ let open: Tracked<boolean> = #ripple.track(false);
3131
3212
  let items: Array<string> = [];
3132
3213
  let map: Map<string, number> = new Map();
3133
3214
  <div>{'test'}</div>
@@ -3211,6 +3292,20 @@ const items = [] as unknown[];`;
3211
3292
  expect(result).toBeWithNewline(expected);
3212
3293
  });
3213
3294
 
3295
+ it('should preserve minus mapped modifiers in TypeScript mapped types', async () => {
3296
+ const input = `type MutableRequired<T> = { -readonly [K in keyof T]-?: T[K] }`;
3297
+ const expected = `type MutableRequired<T> = { -readonly [K in keyof T]-?: T[K] };`;
3298
+ const result = await format(input);
3299
+ expect(result).toBeWithNewline(expected);
3300
+ });
3301
+
3302
+ it('should preserve explicit plus mapped modifiers in TypeScript mapped types', async () => {
3303
+ const input = `type ExplicitReadonlyOptional<T> = { +readonly [K in keyof T]+?: T[K] }`;
3304
+ const expected = `type ExplicitReadonlyOptional<T> = { readonly [K in keyof T]?: T[K] };`;
3305
+ const result = await format(input);
3306
+ expect(result).toBeWithNewline(expected);
3307
+ });
3308
+
3214
3309
  it('should format TypeScript qualified names (TSQualifiedName)', async () => {
3215
3310
  const input = `type T = Foo.Bar;`;
3216
3311
  const expected = `type T = Foo.Bar;`;
@@ -3554,7 +3649,7 @@ try {
3554
3649
  it('properly formats components markup and new lines and leaves one new line between components and <style> if one or more exits', async () => {
3555
3650
  const input = `export component App() {
3556
3651
  <div>
3557
- <RowList rows={#[{id: 'a'}, {id: 'b'}, {id: 'c'}]}>
3652
+ <RowList rows={#ripple[{id: 'a'}, {id: 'b'}, {id: 'c'}]}>
3558
3653
  component Row({id, index, isHighlighted = (index) => (index % 2) === 0}) {
3559
3654
  <div class={{highlighted: isHighlighted(index)}}>{index}{' - '}{id}</div>
3560
3655
 
@@ -3577,7 +3672,7 @@ component RowList({ rows, Row }) {
3577
3672
 
3578
3673
  const expected = `export component App() {
3579
3674
  <div>
3580
- <RowList rows={#[{ id: 'a' }, { id: 'b' }, { id: 'c' }]}>
3675
+ <RowList rows={#ripple[{ id: 'a' }, { id: 'b' }, { id: 'c' }]}>
3581
3676
  component Row({ id, index, isHighlighted = (index) => index % 2 === 0 }) {
3582
3677
  <div class={{ highlighted: isHighlighted(index) }}>
3583
3678
  {index}
@@ -3611,13 +3706,13 @@ component RowList({ rows, Row }) {
3611
3706
 
3612
3707
  it('leaves the shorthand reactive declaration intact and formats the same way as plain objects', async () => {
3613
3708
  const input = `export component App() {
3614
- const obj = #{ a: 1, b: 2, c: 3 };
3615
- let singleUser = #{name:"Test Me", email: "abc@example.com"}
3709
+ const obj = #ripple{ a: 1, b: 2, c: 3 };
3710
+ let singleUser = #ripple{name:"Test Me", email: "abc@example.com"}
3616
3711
  }`;
3617
3712
 
3618
3713
  const expected = `export component App() {
3619
- const obj = #{ a: 1, b: 2, c: 3 };
3620
- let singleUser = #{ name: 'Test Me', email: 'abc@example.com' };
3714
+ const obj = #ripple{ a: 1, b: 2, c: 3 };
3715
+ let singleUser = #ripple{ name: 'Test Me', email: 'abc@example.com' };
3621
3716
  }`;
3622
3717
  const result = await format(input, {
3623
3718
  singleQuote: true,
@@ -3629,12 +3724,12 @@ component RowList({ rows, Row }) {
3629
3724
 
3630
3725
  it('formats single line reactive object into multiline when printWidth is exceeded', async () => {
3631
3726
  const input = `export component App() {
3632
- const obj = #{a: 1, b: 2, c: 3, d: 4, e: 5, f: 6, g: 7, h: 8, i: 9, j: 10, k: 11, l: 12, m: 13, n: 14, o: 15};
3633
- let singleUser = #{name:"Test Me", email: "abc@example.com"}
3727
+ const obj = #ripple{a: 1, b: 2, c: 3, d: 4, e: 5, f: 6, g: 7, h: 8, i: 9, j: 10, k: 11, l: 12, m: 13, n: 14, o: 15};
3728
+ let singleUser = #ripple{name:"Test Me", email: "abc@example.com"}
3634
3729
  }`;
3635
3730
 
3636
3731
  const expected = `export component App() {
3637
- const obj = #{
3732
+ const obj = #ripple{
3638
3733
  a: 1,
3639
3734
  b: 2,
3640
3735
  c: 3,
@@ -3651,7 +3746,7 @@ component RowList({ rows, Row }) {
3651
3746
  n: 14,
3652
3747
  o: 15,
3653
3748
  };
3654
- let singleUser = #{ name: 'Test Me', email: 'abc@example.com' };
3749
+ let singleUser = #ripple{ name: 'Test Me', email: 'abc@example.com' };
3655
3750
  }`;
3656
3751
  const result = await format(input, {
3657
3752
  singleQuote: true,
@@ -3663,13 +3758,13 @@ component RowList({ rows, Row }) {
3663
3758
 
3664
3759
  it('leaves the shorthand reactive array declaration intact and formats the same way as regular array', async () => {
3665
3760
  const input = `export component App() {
3666
- const arr = #[ {a: 1}, { b:2}, {c:3 } ];
3667
- let multi = #[{a: 1}, {b: 2}, {c: 3}, {d: 4}, {e:5}, {f:6}, {g: 7}, {h: 8}, {i:9}, {j: 10}, {k: 11}];
3761
+ const arr = #ripple[ {a: 1}, { b:2}, {c:3 } ];
3762
+ let multi = #ripple[{a: 1}, {b: 2}, {c: 3}, {d: 4}, {e:5}, {f:6}, {g: 7}, {h: 8}, {i:9}, {j: 10}, {k: 11}];
3668
3763
  }`;
3669
3764
 
3670
3765
  const expected = `export component App() {
3671
- const arr = #[{ a: 1 }, { b: 2 }, { c: 3 }];
3672
- let multi = #[
3766
+ const arr = #ripple[{ a: 1 }, { b: 2 }, { c: 3 }];
3767
+ let multi = #ripple[
3673
3768
  { a: 1 },
3674
3769
  { b: 2 },
3675
3770
  { c: 3 },
@@ -4418,7 +4513,7 @@ export component App() {
4418
4513
  it('should keep blank line between components with a trailing comment at the end of the first', async () => {
4419
4514
  const expected = `component SVG({ children }) {
4420
4515
  <svg width={20} height={20} fill="blue" viewBox="0 0 30 10" preserveAspectRatio="none">
4421
- let test = track(8);
4516
+ let test = #ripple.track(8);
4422
4517
  {test}
4423
4518
  <polygon points="0,0 30,0 15,10" />
4424
4519
  </svg>
@@ -4684,6 +4779,21 @@ component Polygon() {
4684
4779
  });
4685
4780
 
4686
4781
  describe('<tsx:react>', () => {
4782
+ it('should preserve namespace in generic JSX namespaced tags', async () => {
4783
+ const input = `component App() {
4784
+ <tsx:react><xml:space></xml:space></tsx:react>
4785
+ }`;
4786
+
4787
+ const expected = `component App() {
4788
+ <tsx:react>
4789
+ <xml:space></xml:space>
4790
+ </tsx:react>
4791
+ }`;
4792
+
4793
+ const result = await format(input, { singleQuote: true });
4794
+ expect(result).toBeWithNewline(expected);
4795
+ });
4796
+
4687
4797
  it('should format JSX inside <tsx:react> tags', async () => {
4688
4798
  const input = `component App() {
4689
4799
  <div>
@@ -4884,7 +4994,7 @@ component Polygon() {
4884
4994
 
4885
4995
  it('should preserve @ symbol in JSX attributes inside <tsx:react>', async () => {
4886
4996
  const input = `component App() {
4887
- const count = track(0);
4997
+ const count = #ripple.track(0);
4888
4998
 
4889
4999
  <div>
4890
5000
  <h1>{'Hello, from Ripple!'}</h1>
@@ -4895,7 +5005,7 @@ component Polygon() {
4895
5005
  }`;
4896
5006
 
4897
5007
  const expected = `component App() {
4898
- const count = track(0);
5008
+ const count = #ripple.track(0);
4899
5009
 
4900
5010
  <div>
4901
5011
  <h1>{'Hello, from Ripple!'}</h1>
@@ -4969,10 +5079,10 @@ component App() {
4969
5079
  expect(result).toBeWithNewline(expected);
4970
5080
  });
4971
5081
  it('should format JSXExpressionContainer with complex expressions', async () => {
4972
- const input = `component App(){let count=track(0);<tsx:react><div>{count*2+10}</div>{getMessage("test")}</tsx:react>}`;
5082
+ const input = `component App(){let count=#ripple.track(0);<tsx:react><div>{count*2+10}</div>{getMessage("test")}</tsx:react>}`;
4973
5083
 
4974
5084
  const expected = `component App() {
4975
- let count = track(0);
5085
+ let count = #ripple.track(0);
4976
5086
  <tsx:react>
4977
5087
  <div>
4978
5088
  {count * 2 + 10}