You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Multi-line arrow-function expression body should not add line break after arrow in certain circumstances #107
changed the title [-]Multi-line arrow-function expression body should maintain absence or presence of line break after arrow.[/-][+]Multi-line arrow-function expression body should not add line break after arrow.[/+]on Feb 20, 2021
changed the title [-]Multi-line arrow-function expression body should not add line break after arrow.[/-][+]Multi-line arrow-function expression body should not add line break after arrow in certain circumstances[/+]on Mar 20, 2021
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.:
constadd=x=>y=>{returnx+y}
becomes:
constadd=x=>y=>{returnx+y;}
which is less readable as the "y" is now in a different line than the "x" so harder to reason about.
Activity
[-]Multi-line arrow-function expression body should maintain absence or presence of line break after arrow.[/-][+]Multi-line arrow-function expression body should not add line break after arrow.[/+][-]Multi-line arrow-function expression body should not add line break after arrow.[/-][+]Multi-line arrow-function expression body should not add line break after arrow in certain circumstances[/+]dsherret commentedon Sep 30, 2021
Another similar example from @declanvong:
https://dprint.dev/playground/#code/GYexAoDsFMHcAIDyAjAVuA3gKHr+BDALnlBABoc9ljl8AnCgXwEpmBuIA/language/typescript
Outputs:
(I know these examples are different, but perhaps the implementation could use the same logic)
stagas commentedon Mar 23, 2022
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.:
becomes:
which is less readable as the "y" is now in a different line than the "x" so harder to reason about.
Add `arrowFunction.noNewLineBeforeFnCall` option
feat: Add `arrowFunction.noNewLineBeforeFnCall` option
feat: add `arrowFunction.noNewLineBeforeFnCall` option
tennox commentedon Jun 11, 2023
my example:
(
htmlshouldn't go on next line)Did not find any config to change this behaviour