WebStorm code style - Function definition - Keep one-liner if body empty


When creating dummy functions, with an empty body, I would like them to look like that:

start : function() {},
pause : function() {},

However, WebStorm reformats them this way:

start : function() {
pause : function() {

It is fine for every other case, but I don't like it when the functions have an empty body.
Is there any way to configure WebStorm in accordance with this wanted behavior?

Thanks again.


Code Style/JavaScript/Wrapping and Braces, Keep when reformatting/Simple methods in one line



I would like to keep only empty functions in one line, not simple functions.

function xyz() {}
function xyz(abc) {
return abc + 1;


It also doesn't apply to classes:

export class AppRoutingModule {

for classes, please try "Keep when reformatting > Simple blocks in one line"

If you need a separate option for functions with empty body, please feel free to create a request in youtrack, https://youtrack.jetbrains.com/issues/WEB



Thanks for the tip, but it only works if the class is not being exported.

export class AppRoutingModule {

class AppRoutingModule {}

Please sign in to leave a comment.