Commit graph

1471 commits

Author SHA1 Message Date
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
Boshen
9842be4461
refactor(parser): remove duplicated code 2023-11-29 18:23:32 +08:00
Dunqing
3a4261ff5d
fix(prettier): keep EmptyStatement in Program (#1576) 2023-11-29 18:22:40 +08:00
IWANABETHATGUY
4043ca9d92
feat(ast): add enter node and scope for VisitMut trait (#1570) 2023-11-29 15:27:34 +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
Hao Cheng
72dd72b466
feat(linter): eslint-plugin-unicorn/no-unreadable-iife (#1572)
This PR implements the
[eslint-plugin-unicorn/no-unreadable-iife](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-unreadable-iife.md)
rule.

Tests taken from
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/test/no-unreadable-iife.mjs.

Related issue: #684
2023-11-29 11:27:44 +08:00
Ken-HH24
3b2b6a013a
feat(linter): eslint-plugin-unicorn no-await-expression-member (style) (#1569) 2023-11-29 11:26:29 +08:00
IWANABETHATGUY
c034eee5c1
feat(transformer): handle invalid react jsx runtime (#1502) 2023-11-28 23:19:58 +08:00
Wenzhe Wang
3fe9cccb9e
feat(playground): format Prettier IR (#1567) 2023-11-28 13:51:47 +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
magic-akari
92c1d9d527
feat(transform): TypeScript Enum (#1173) 2023-11-28 10:33:01 +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
Radu Baston
afeed17be9
feat(linter): eslint-lugin-unicorn no_useless_length_check (#1541)
I have an issue with this rule. I am able to identify the condition that
breaks the rule, but I can't manage to get the fix done. I was thinking
of concatenating the valid conditions with the common operator, but I am
not sure how to do that (from `Expression` to turn to `string` to be
passed as a parameter to the fix). any help is appreciated.

NOTE: I will probably do some refactorization for this code after
implementing the fix

---------

Co-authored-by: Radu Baston <radu.baston@sectorlabs.ro>
2023-11-27 19:53:39 +08:00
Boshen
6670d94708
chore(rust): remove unnecessary clippy::non_upper_case_globals (#1557) 2023-11-27 14:31:38 +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
u9g
9a5bb008e7
feat(query): Add is_getter, is_setter, is_constructor to all Function implementors (#1526)
---

<details open="true"><summary>Generated summary (powered by <a href="https://app.graphite.dev">Graphite</a>)</summary>

> # TL;DR
> This pull request adds new properties to the `ArrowFunction`, `FnDeclaration`, and `Function` interfaces in the Trustfall schema. It also adds implementation for resolving these properties in the `adapter.rs` and `properties.rs` files. Additionally, it adds a new method `function_scope_flag` to the `Vertex` struct in the `vertex.rs` file.
> 
> # What changed
> - Added new properties (`is_getter`, `is_setter`, `is_constructor`) to the `ArrowFunction`, `FnDeclaration`, and `Function` interfaces in the Trustfall schema.
> - Implemented the resolution of these properties in the `resolve_arrow_function_property`, `resolve_fn_declaration_property`, and `resolve_function_property` functions in the `properties.rs` file.
> - Added a new method `function_scope_flag` to the `Vertex` struct in the `vertex.rs` file.
> 
> # How to test
> 1. Run the test suite to ensure that all existing tests pass.
> 2. Add new tests to cover the newly added properties and the `function_scope_flag` method.
> 3. Run the test suite again and ensure that all tests pass.
> 
> # Why make this change
> - The new properties (`is_getter`, `is_setter`, `is_constructor`) provide additional information about functions in the Trustfall schema, allowing clients to query for these properties.
> - The `function_scope_flag` method in the `Vertex` struct provides a convenient way to access the scope flags of a function node, which can be useful for various analysis and processing tasks.
</details>
2023-11-27 12:22:41 +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
Ken-HH24
a2510be7a0
feat(linter): no-is-mounted for eslint-plugin-react (#1550)
Try to implement `no-is-mounted` for #1022
2023-11-26 11:06:08 +00:00
Boshen
023e6eabcd
chore(resolver): add a path alias test (#1549) 2023-11-26 07:14:32 +00:00
Cameron
08b659455b
refactor(prettier) move assignment printing into seperate file (#1544) 2023-11-26 14:09:57 +08:00
Radu Baston
59d0428eb5
feat(linter): eslint 9.0 no empty static block (#1543)
Related [issue](https://github.com/oxc-project/oxc/issues/1191)

---------

Co-authored-by: Radu Baston <radu.baston@sectorlabs.ro>
2023-11-25 17:09:50 +00:00
magic-akari
9ff0ffcc6f
feat(ast): implement new proposal-import-attributes (#1476)
- [Import Attributes](https://tc39.es/proposal-import-attributes)
2023-11-25 15:56:09 +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
Cameron
41bb0060eb
fix(linter) fix panic in no hex escape (#1540)
🦀🦶🔫

lol https://twitter.com/boshen_c/status/1719033308682870891

closes #1539
2023-11-24 23:57:02 +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
RiESAEX
8afda7d247
feat(linter): eslint-plugin-unicorn: escape-case (#1495)
[Rule](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/escape-case.md)
#684
2023-11-24 10:44:34 +08:00
Boshen
6ebb42dbd7
fix(ast): remove debug_assertions from debug_name 2023-11-24 10:24:15 +08:00
Boshen
78c6fcd1d0
feat(prettier): improve format of ExportDefaultDeclaration (#1520) 2023-11-23 21:52:56 +08:00