Js-beautify: Chained method indenting inconsistancy

Created on 27 Feb 2016  路  4Comments  路  Source: beautify-web/js-beautify

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()
]
javascript bug

Most helpful comment

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

All 4 comments

So in array.

And also in arrow functions:

arg =>
    foo()
    .bar()

but

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

expected:

arg =>
    foo()
        .bar()

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

:+1:

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)
)
Was this page helpful?
0 / 5 - 0 ratings