Commit graph

231 commits

Author SHA1 Message Date
Deivid Almeida
c1cfd1759e
feat(linter): no-irregular-whitespace rule (#1835)
Parser, trivias and trivias_builder were edited to get all whitespaces.
Now Trivias struct store comments and whitespaces Vec. After that, i
will implement the no-irregular-whitespace rule.

P.S.: There isn't a way to implement this feature without lose a little
bit of performance, comparing with my last PR #1819 to minimax this
trouble instead of store the irregular whitespace as Span it was stored
as u32, i removed a map iterator and removed too a unused function. If
you have a suggestion about it pls give me a feedback.
2023-12-31 12:05:38 +08:00
IWANABETHATGUY
4bbc977971
chore: upgrade rustc toolchain to stable 1.75.0 (#1853)
ref: 
https://blog.rust-lang.org/2023/12/28/Rust-1.75.0.html
2023-12-29 12:20:51 +08:00
Cameron
29a4a35fd8
fix(prettier) add missing closing brace for dock debug (#1786) 2023-12-23 10:59:13 +08:00
Wenzhe Wang
c49a1f6b32
feat(prettier): add print_binaryish_expressions (#1664) 2023-12-13 22:52:53 +08:00
Dunqing
0c19991471
feat(prettier): print CallExpression arguments correctly (#1631) 2023-12-10 15:59:13 +08:00
Dunqing
6e5aad2639
feat(prettier): add ConditionalGroup command (#1635) 2023-12-07 20:12:45 +08:00
Wenzhe Wang
0dec110790
refactor(prettier): move the format of Function's key to PropertyKey (#1639) 2023-12-07 17:30:48 +08:00
Wenzhe Wang
286644714f
feat(prettier): wrap parameters in indent (#1633) 2023-12-06 10:20:31 +08:00
Wenzhe Wang
633455aba6
refactor(prettier): add print_method_value (#1632) 2023-12-06 10:16:09 +08:00
Wenzhe Wang
2aa5f7db91
feat(prettier): finish should_hug_the_only_function_parameter (#1626) 2023-12-05 22:55:12 +08:00
Cameron
b7b3073f3f
feat(prettier) port should_break_after_operator (#1606) 2023-12-02 20:40:25 +08:00
Cameron
502d61dc9f
fix(prettier) fix use chain formatting (#1605) 2023-12-02 15:44:25 +08:00
Boshen
811b219b27
feat(prettier): add parens to new class {} (#1604) 2023-12-01 21:36:01 +08:00
Boshen
bb61f10399
feat(prettier): handle parens for (x % y) % z (#1603) 2023-12-01 21:29:56 +08:00
Cameron
b4e90a723a
feat(prettier): implement has_comment, improve blank lines when printing arrays (#1601) 2023-12-01 20:52:26 +08:00
Cameron
deac95e274
feat(prettier): print blank lines when printing array concisely (#1600) 2023-12-01 20:48:10 +08:00
Boshen
f4f392e19f
feat(prettier): add parens to left of instanceof (#1602) 2023-12-01 19:08:45 +08:00
Cameron
66452c95f5
fix(prettier) print computed object property key correctly (#1599) 2023-12-01 18:36:38 +08:00
Cameron
0134211b6f
fix(prettier) use print_assignment for ObjectProperty (#1598) 2023-12-01 18:32:03 +08:00
Boshen
da87b9b29e
feat(prettier): binaryish expressions with parens (#1597) 2023-12-01 13:52:22 +08:00
Boshen
e3c54b92c9
fix(prettier): object pattern in function parameters (#1595) 2023-11-30 23:49:24 +08:00
Wenzhe Wang
9f38072002
feat(tasks): add visualize_end_of_line (#1593) 2023-11-30 23:42:57 +08:00
Dunqing
39188d00e1
feat(prettier): support arrowParens option (#1592) 2023-11-30 17:41:34 +08:00
Boshen
6ec257ba2d
feat(prettier): add --no-semi to prettier example (#1588) 2023-11-29 23:33:35 +08:00
Boshen
fd6a3ed918
feat(prettier): format for((async) of and for((let) of (#1586) 2023-11-29 22:55:42 +08:00
Boshen
1bd1c5b51b
feat(prettier): check parens for (let)[a] = 1 (#1585) 2023-11-29 21:57:59 +08:00
Boshen
c50fcececa
feat(prettier): wrap return statements with parentheses (#1583) 2023-11-29 19:31:55 +08:00
Boshen
b8ce6266ad
feat(prettier): handle parens for sequence expression (#1582) 2023-11-29 19:15:57 +08:00
Boshen
405d1228a0
feat(prettier): wrap BindingIdentifier (#1581) 2023-11-29 19:08:29 +08:00
Dunqing
f19032e102
feat(prettier): support quoteProps option in PropertyKey (#1578) 2023-11-29 18:32:30 +08:00
Dunqing
93d5b0f879
pref(prettier): using allocator String to avoid reallocation (#1577) 2023-11-29 18:27:27 +08:00
Dunqing
3a4261ff5d
fix(prettier): keep EmptyStatement in Program (#1576) 2023-11-29 18:22:40 +08:00
Boshen
7236368d5a
feat(prettier): implement is_next_line_empty_after_index (#1575) 2023-11-29 14:37:33 +08:00
Boshen
a9f0206805
feat(prettier): print es5 comma for object expression (#1574) 2023-11-29 13:36:28 +08:00
Boshen
c5b138f006
refactor(prettier): clean up object::print_object_properties (#1573) 2023-11-29 12:30:06 +08:00
Cameron
9a0a6f5004
feat(prettier) further improve class printing (#1566) 2023-11-28 10:59:37 +08:00
Cameron
522cf29489
feat(prettier) improve class printing (#1565) 2023-11-28 10:54:33 +08:00
Cameron
2bfd28e6f5
fix(prettier) remove unmatched brace when displaying doc (#1564) 2023-11-28 10:50:25 +08:00
Cameron
83f25fc9b3
fix(prettier) fix printing of call args when in break mode (#1563)
To test, format:
```ts
foobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobar();
```

Previously:
```ts
foobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobar(
  ,
);
```

Now:
```ts
foobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobar();
```
2023-11-28 10:45:27 +08:00
Cameron
cc25f7897d
fix(prettier) Fix printing of array expressions (#1562) 2023-11-28 10:39:37 +08:00
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