js-beautify icon indicating copy to clipboard operation
js-beautify copied to clipboard

Chained method indenting inconsistancy

Open iofjuupasli opened this issue 9 years ago • 4 comments
trafficstars

Input:

var a = foo()
    .bar();

var arr = [
    foo()
        .bar()
]

Expected output:

var a = foo()
    .bar();

var arr = [
    foo()
        .bar()
]

Actual output:

var a = foo()
    .bar();

var arr = [
    foo()
    .bar()
]

iofjuupasli avatar Feb 27 '16 14:02 iofjuupasli

So in array.

And also in arrow functions:

arg =>
    foo()
    .bar()

but

arg => {
    foo()
        .bar()
}

expected:

arg =>
    foo()
        .bar()

iofjuupasli avatar Feb 27 '16 14:02 iofjuupasli

+1. We also encouter this. Maybe that could be a switch

kichooo avatar May 30 '16 16:05 kichooo

:+1:

syzer avatar May 30 '16 16:05 syzer

And another example in arrow functions:

onePromise.then(
    result => twoPromise()
        .then(resolve, reject),
    error => reject(error)
)

Result:

onePromise.then(
    result => twoPromise()
    .then(resolve, reject),
    error => reject(error)
)

Must be:

onePromise.then(
    result => twoPromise()
        .then(resolve, reject),
    error => reject(error)
)

IgorNovozhilov avatar Oct 26 '16 17:10 IgorNovozhilov