Formatting chained function calls is weird
- Dominant language
- Rust
- Stars
- 108k
- Forks
- 6.4k
- Avg merge
- 2d 20h
- Merged PRs (30d)
- 58
Description
Formatting chained function calls should move each call to a separate line, similar to how prettier does it. I feel like we should do something simple like "If there are more than 2 function calls, move them each to a separate line".
Actual:
```ts
const result = someObject.getProperty("users").filter((user) => user.isActive)
.map((user) => user.id).sort((a, b) => a - b).find((id) => id > 100);
```
Expected:
```ts
const result = someObject
.getProperty('users')
.filter(user => user.isActive)
.map(user => user.id)
.sort((a, b) => a - b)
.find(id => id > 100);
```
Version: Deno 2.3.1
Contributor guide
Research direction
Reproduce the chained-call example with Deno 2.3.1, then locate the formatter implementation and its existing tests. Confirm the desired line-breaking rule and add coverage for the example; done means chained calls format with each call on its own line without regressing other formatting.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust, typescript
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100