Tapppi
Tapppi

Reputation: 315

Option to not add line breaks in no-op (empty) functions in JavaScript (IntelliJ Web/PHP storm)

I can not for the life of me find a formatter option to turn off automatic line breaks inside no-op function braces. The line breaks are added automatically for both arrow functions and regular functions. This is frustrating when for example passing no op functions to other functions (as a hook or callback), i.e. wrapWithCommonErrors(() => {}).

function() {} becomes
function() { }

() => {} becomes
() => { }

Upvotes: 13

Views: 2315

Answers (1)

Tobias Timm
Tobias Timm

Reputation: 2050

Have you tried the Simple blocks in one line option?

You can find it at

File -> Settings -> Code Style -> JavaScript -> Wrapping and Braces -> Keep when reformatting

Upvotes: 22

Related Questions