js-formatter icon indicating copy to clipboard operation
js-formatter copied to clipboard

Disable line breaks for arrow functions without braces

Open Loskir opened this issue 3 years ago • 1 comments

Hello!

I have this piece of code:

f(() => f2({
  a: 1,
}))

and it gets formatted into something like

f(() =>
  f2({
    a: 1,
  })
);

but I don't like that line break after =>. Is there a way to discourage dprint from adding it? I'd like to see something like

f(() => f2({
  a: 1,
}));
// (no changes)

or

f(
  () => f2({
    a: 1,
  })
)
// (arrow function on a new line but no break after =>)

Here's a playground link: https://dprint.dev/playground/#code/GYChEoAIF4D5OAJhAbwFCU5AhgLkgIxoC+44QA/language/typescript

Thank you!

Loskir avatar Nov 06 '22 23:11 Loskir

Please raise this issue in the dprint-plugin-typescript repo

so1ve avatar Apr 07 '23 09:04 so1ve