-
Notifications
You must be signed in to change notification settings - Fork 62
Multi-line arrow-function expression body should not add line break after arrow in certain circumstances #107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Another similar example from @declanvong: foo(new Obj({
a: foo,
b: bar,
})); Outputs: foo(
new Obj({
a: foo,
b: bar,
}),
); (I know these examples are different, but perhaps the implementation could use the same logic) |
I agree with @WearyMonkey, arrow functions that return single expression should be able to be compacted as much as they can, the current behavior discourages the usage of higher order functions in cases like currying etc.: const add = x => y => {
return x + y
} becomes: const add = x =>
y => {
return x + y;
} which is less readable as the "y" is now in a different line than the "x" so harder to reason about. |
Resolves dprint#107. If set to true dprint will not format this: ```typescript [].map(() => test({ foo: 1, bar: 2, })); ```` to this: ```typescript [].map(() => test({ foo: 1, bar: 2, }) ); ```
Resolves dprint#107. If set to true dprint will not format this: ```typescript [].map(() => test({ foo: 1, bar: 2, })); ```` to this: ```typescript [].map(() => test({ foo: 1, bar: 2, }) ); ```
Resolves dprint#107. If set to true dprint will not format this: ```typescript [].map(() => test({ foo: 1, bar: 2, })); ```` to this: ```typescript [].map(() => test({ foo: 1, bar: 2, }) ); ```
my example: const render = () => html`
<div b="1 rd-4 gray-300">
<button m-4 p-2 rd onclick="${addKid}">+</button>
</div>
` ( Did not find any config to change this behaviour |
Describe the bug
dprint-plugin-typescript version: 0.40.1
Input Code
Expected Output
Actual Output
Playground link
Adding a line break before the arrow makes a lot of code unnecessarily verbose with small expressions.
Thank you!
The text was updated successfully, but these errors were encountered: