Thank you for this post. Actually there is an issue about this: https://github.com/eslint/eslint/issues/4081
2016年2月3日(水) 12:43 Jeremy Scheff <[email protected]>: > Sorry the title of this message is horrifying. But let me explain. This > indentation is pretty well accepted: > > funcThatReturnsPromise() > .then(otherFunction); > > So is this: > > funcThatReturnsPromise() > .then(otherFunction) > .then(function () { > // whatever > }); > > But what happens when funcThatReturnsPromise accepts a function as an > argument, and you want to define that function inline? Maybe something like > this: > > funcThatReturnsPromise(function () { > // stuff > }) > .then(otherFunction) > .then(function () { > // whatever > }); > > However that produces an ESLint error if you have the "indent" rule > enabled: > > 3:5 - Expected indentation of 0 space characters but found 4. > > You can get rid of that error by unindenting the promise chain: > > funcThatReturnsPromise(function () { > // stuff > }) > .then(otherFunction) > .then(function () { > // whatever > }); > > But I think that looks ugly, for the same reason this looks ugly: > > > funcThatReturnsPromise() > .then(otherFunction); > > Thoughts? > > Is the ESLint indent rule behaving as intended? > > Is it crazy for me to want to pass a function as an argument inline? > > -- > You received this message because you are subscribed to the Google Groups > "ESLint" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "ESLint" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
