Change indentation of arrow function in Javascript

Hi

which JavaScript formatting option do I have to modify to instead of this formatting result:

client
.setClaimForUser({ userId, claim })
.then(() => {
return resolve(true);
},
err => reject(err));

get this one:

client
.setClaimForUser({ userId, claim })
.then(() => {
return resolve(true);
},
err => reject(err));

Thanks

3 comments
Comment actions Permalink

No, it's not possible. The motivation for not placing a callback at the same level as function call in this case was to be consistent with regular parameters: when wrapped, they are always indented

client
.setClaimForUser({ userId, claim })
.then(firstparam,
secondparam);

doesn't look good, does it?

-1
Comment actions Permalink

I was fine with this indentation until I ran into an issue with the ESLint "indent" rule yesterday. 

I asked at Stackoverflow and some people think the ESLint rule is right and my indentation based on WebStorm is wrong:

https://stackoverflow.com/questions/44271554/which-eslint-rule-applies-to-promise-arrow-function-indent

I think ESLint handles the mentioned param issue with another rule option so it can differentiate between callbacks and params.

1
Comment actions Permalink

Has there been any resolve here?  I too am experiencing the same problem as Alexander.

0

Please sign in to leave a comment.