Commit graph

191 commits

Author SHA1 Message Date
Cameron
fe7f6efff2
fix(prettier) Fix debug printing if IfBreak` doc (#1561) 2023-11-28 10:34:28 +08:00
Cameron
cda0b97ade
feat(prettier) use groupId in fluid assignments (#1560) 2023-11-28 10:29:32 +08:00
Boshen
7d9d04c569
refactor(prettier): align line with prettier (#1559)
This PR alines all the line types with prettier

```
const hardlineWithoutBreakParent = { type: DOC_TYPE_LINE, hard: true };
const literallineWithoutBreakParent = {
  type: DOC_TYPE_LINE,
  hard: true,
  literal: true,
};


const line = { type: DOC_TYPE_LINE };
const softline = { type: DOC_TYPE_LINE, soft: true };
const hardline = [hardlineWithoutBreakParent, breakParent];
const literalline = [literallineWithoutBreakParent, breakParent];
```

101598f94f/src/document/builders.js (L165-L175)
2023-11-27 23:11:53 +08:00
Wenzhe Wang
21dffec8be
feat(prettier): add id on IfBreak and Group (#1551) 2023-11-27 22:53:32 +08:00
Dunqing
0e1abae757
feat(prettier): filter out EmptyStatement in BlockStatement (#1546) 2023-11-27 22:45:45 +08:00
Boshen
6e7892fcf0
refactor(prettier): move comment printing to its own directory (#1556) 2023-11-27 14:22:15 +08:00
Boshen
cc382835ef
feat(prettier): trailing comment (wip) (#1538) 2023-11-27 14:08:39 +08:00
Dunqing
85e8c8bad5
fix(prettier): incorrect order of print in AssignmentTargetPropertyProperty (#1545) 2023-11-27 12:18:32 +08:00
Cameron
d5b636b197
feat(prettier) Improve assignment compatibility (#1547) 2023-11-27 10:01:01 +08:00
Cameron
08b659455b
refactor(prettier) move assignment printing into seperate file (#1544) 2023-11-26 14:09:57 +08:00
Wenzhe Wang
46d1086c3e
feat(prettier): add LineSuffix Doc (#1542) 2023-11-25 13:46:02 +08:00
Wenzhe Wang
924d99e8d7
feat(prettier): init command of Fill (#1460) 2023-11-25 12:03:26 +08:00
Boshen
13cac62402
feat(prettier): print leading comments for all ast nodes (#1537) 2023-11-25 00:35:51 +08:00
Dunqing
3ca2f50773
feat(prettier): align ObjectProerty with prettier (#1536) 2023-11-24 20:20:07 +08:00
Dunqing
ac8a5ce574
feat(prettier): support handling of BlockStatement within consequent in SwitchCase (#1533) 2023-11-24 17:15:29 +08:00
Dunqing
ec0ee5cd07
feat(prettier): keep empty lines in SwitchStatement (#1532) 2023-11-24 17:10:27 +08:00
Boshen
4a0d18048b
feat(prettier): format () => ({} ? 1 : 2); to () => ({}) ? 1 : 2; (#1534) 2023-11-24 17:07:19 +08:00
Dunqing
75c75887e3
feat(prettier): trim spaces when printing hardline (#1531) 2023-11-24 17:05:20 +08:00
Boshen
e55fdc6452
feat(prettier): add parens to conditional and arrow expr (#1530) 2023-11-24 15:07:29 +08:00
Boshen
6e81b3d41a
fix(prettier): pop the stack in should_wrap_function_for_export_default (#1529) 2023-11-24 14:57:06 +08:00
Boshen
78c6fcd1d0
feat(prettier): improve format of ExportDefaultDeclaration (#1520) 2023-11-23 21:52:56 +08:00
Wenzhe Wang
f4c89ce5a6
feat(prettier): implement DocBuidler trait for Printer and Prettier (#1519) 2023-11-23 21:48:13 +08:00
Dunqing
3758e6f6a5
feat(prettier): handle the logic inside the parentheses in BinaryExpression and LogicalExpression (#1516) 2023-11-23 18:32:25 +08:00
Dunqing
490a589ded
feat(prettier): print binarylish correctly in SwitchStatement (#1515) 2023-11-23 18:29:00 +08:00
Dunqing
635008a408
feat(prettier): support print empty switch (#1514) 2023-11-23 16:19:42 +08:00
Boshen
ef59f544b4
feat(prettier): handle binary in in for statement init (#1512) 2023-11-23 12:50:30 +08:00
Dunqing
bec365e1b6
feat(prettier): support propagate breaks (#1511)
regression tests are the expected result
2023-11-23 10:44:41 +08:00
Boshen
2d5e0d5d07
feat(prettier): handle parens for member expression inside new expression (#1505) 2023-11-22 16:22:49 +00:00
Boshen
6410502cc6
refactor(prettier): rename file need_parens -> needs_parens (#1504) 2023-11-23 00:04:00 +08:00
Boshen
d3b7629b46
feat(prettier): handle parens for logical assignment expression (#1503) 2023-11-22 23:58:43 +08:00
Boshen
93c461a5b9
feat(prettier): format number in member expression (#1499) 2023-11-22 21:52:06 +08:00
Boshen
567c6ed757
feat(prettier): print directives (#1497) 2023-11-22 19:39:25 +08:00
Boshen
cf803d379a
feat(prettier): add parens to ExportDefaultDeclaration (#1494) 2023-11-22 19:34:37 +08:00
Dunqing
79c67d15c0
perf(prettier): check commandjs or amd in CallExpression only (#1491) 2023-11-22 10:57:31 +08:00
Boshen
064353c97e
feat(prettier): turn off preserve_parens and start working on need-parens (#1487) 2023-11-21 16:26:56 +00:00
Shannon Rothe
8934ddb590
feat(prettier): basic TaggedTemplateExpression printing (#1486) 2023-11-21 22:15:29 +08:00
Dunqing
347b5721c0
feat(prettier): print multiple variable declarator correctly in VariableDeclaration (#1485) 2023-11-21 18:54:26 +08:00
Dunqing
f1874c7955
feat(prettier): should be newline if break in AssigmentExpression (#1484) 2023-11-21 18:50:26 +08:00
Dunqing
c762a85fcc
feat(prettier): print inner comment in PropertyKey (#1479) 2023-11-21 17:26:36 +08:00
Dunqing
79c2bac6b1
feat(prettier): support longer source in ImportExpression (#1478) 2023-11-21 17:21:23 +08:00
Dunqing
51a78e2223
feat(prettier): support print inner comment in CallExpression (#1475) 2023-11-21 12:28:46 +08:00
Dunqing
d64ed0a953
feat(prettier): support format commonjs and amd call (#1473) 2023-11-21 10:05:39 +08:00
magic-akari
f81f15ff71
fix(prettier): Private Field Expression (#1459) 2023-11-20 23:32:16 +08:00
Wenzhe Wang
5aca375a94
feat(prettier): add should_break for array (#1454) 2023-11-20 22:58:52 +08:00
magic-akari
4c213a1c14
fix(prettier): async arrow expression (#1457) 2023-11-20 22:58:37 +08:00
magic-akari
59b8fdfaa5
fix(prettier): class extends clause (#1456) 2023-11-20 21:45:28 +08:00
magic-akari
18d8be0353
fix(prettier): class without name (#1455) 2023-11-20 21:41:14 +08:00
magic-akari
eecf8d3dc6
fix(prettier): print_method (#1453) 2023-11-20 12:41:36 +00:00
Shannon Rothe
712505bfce
chore(prettier): fix typo in function name (#1451)
Small typo on the function name cloned from the Prettier repo
2023-11-20 18:51:45 +08:00
Boshen
0bf3dbfde4
feat(prettier): add infra for need_parens (#1450) 2023-11-20 17:18:39 +08:00