Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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
() => { }

like image 972
Tapppi Avatar asked Apr 19 '16 21:04

Tapppi


1 Answers

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

like image 138
Tobias Timm Avatar answered Oct 17 '22 02:10

Tobias Timm