beautifier / beautifier/js-beautify

break_chained_methods behaviour

Open
#809 3 comments 2 reactions 0 assignees View on GitHub
language: javascript type: enhancement
Dominant language
JavaScript
Stars
9k
Forks
1.4k
PR merge metrics
No merged PRs in 30d

Description

There shoud be option to set max num of chained methods before breaking it:

Eg:

```
"break_chained_methods": 2

this.$("#fileName").val().addClass("disabled")
.prop("disabled", true)
```

I see no sense in breaking when there is only 1 meth (it's not a chain in this case :)). So maybe default behaviour should be: if there is more than 1 chained meth then perform breaking.

Contributor guide

Open the contributing guide

Research direction

Start by locating the existing break_chained_methods option and the formatter tests that cover chained calls. Check how the current setting decides when to break, then define the threshold behavior shown in the issue and verify the example output plus the default behavior in tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.