@tsrx/prettier-plugin 0.3.44 → 0.3.46

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsrx/prettier-plugin",
3
- "version": "0.3.44",
3
+ "version": "0.3.46",
4
4
  "description": "Ripple plugin for Prettier",
5
5
  "type": "module",
6
6
  "module": "src/index.js",
@@ -26,11 +26,11 @@
26
26
  "devDependencies": {
27
27
  "@types/node": "^24.3.0",
28
28
  "prettier": "^3.8.3",
29
- "ripple": "0.3.44"
29
+ "ripple": "0.3.46"
30
30
  },
31
31
  "dependencies": {
32
- "@tsrx/core": "0.0.24",
33
- "@tsrx/ripple": "0.0.26"
32
+ "@tsrx/core": "0.0.26",
33
+ "@tsrx/ripple": "0.0.28"
34
34
  },
35
35
  "files": [
36
36
  "src/"
package/src/index.js CHANGED
@@ -2519,9 +2519,11 @@ function printComponent(
2519
2519
  contentParts.push(statements);
2520
2520
  }
2521
2521
 
2522
+ const isArrowComponent = node.metadata?.arrow === true && !node.id && !args.skipComponentLabel;
2523
+
2522
2524
  // Use Prettier's standard block statement pattern
2523
2525
  /** @type {Doc[]} */
2524
- const parts = [signatureParts, ' {'];
2526
+ const parts = [signatureParts, isArrowComponent ? ' => {' : ' {'];
2525
2527
 
2526
2528
  if (statements.length > 0) {
2527
2529
  // Build content manually with proper spacing
@@ -2605,10 +2607,14 @@ function printComponent(
2605
2607
  contentParts.push(doc);
2606
2608
  }
2607
2609
 
2608
- return [signatureParts, ' ', group(['{', indent([hardline, contentParts]), hardline, '}'])];
2610
+ return [
2611
+ signatureParts,
2612
+ isArrowComponent ? ' => ' : ' ',
2613
+ group(['{', indent([hardline, contentParts]), hardline, '}']),
2614
+ ];
2609
2615
  }
2610
2616
 
2611
- parts[1] = ' {}';
2617
+ parts[1] = isArrowComponent ? ' => {}' : ' {}';
2612
2618
  }
2613
2619
  return parts;
2614
2620
  }
package/src/index.test.js CHANGED
@@ -1857,7 +1857,7 @@ files = [...(files ?? []), ...dt.files];`;
1857
1857
  expect(result).toBeWithNewline(expected);
1858
1858
  });
1859
1859
 
1860
- it('should preserve component as a named or an anonymous property', async () => {
1860
+ it('should preserve component properties in named, legacy anonymous, and arrow forms', async () => {
1861
1861
  const expected = `const UI = {
1862
1862
  span: component Span() {
1863
1863
  <span>{'Hello from Span'}</span>
@@ -1867,6 +1867,9 @@ files = [...(files ?? []), ...dt.files];`;
1867
1867
  {children}
1868
1868
  </button>
1869
1869
  },
1870
+ arrowButton: component({ children }) => {
1871
+ <button>{children}</button>
1872
+ },
1870
1873
  };`;
1871
1874
 
1872
1875
  const result = await format(expected, { singleQuote: true, printWidth: 100 });