dprint-plugin-typescript
dprint-plugin-typescript copied to clipboard
Don't put the body expression of an arrow function on a new line and indentation level without also enclosing it within parentheses
Currently I have code like this. This instance is written as an item in a function's multi-line argument list, hence the trailing comma:
(args...) => myFunction({
prop1: etc,
prop2: etc,
prop3: etc,
}),
As above is my preferred way of formatting this code, but I would also accept one of these:
(args...) => (myFunction({
prop1: etc,
prop2: etc,
prop3: etc,
})),
(args...) => (
myFunction({
prop1: etc,
prop2: etc,
prop3: etc,
})
),
However, dprint is formatting this code like so, with my current settings:
(args...) =>
myFunction({
prop1: etc,
prop2: etc,
prop3: etc,
}),
I think that arbitrary indented blocks without enclosing parens/brackets/braces harms code readability and should always be avoided. But I haven't found an option that I can use to change this behavior.
Might be related to #746