millermedeiros / esformatter

ECMAScript code beautifier/formatter
MIT License
970 stars 91 forks source link

Add a space after a function declaration identifier #425

Closed pmcelhaney closed 8 years ago

pmcelhaney commented 8 years ago

Given a function declaration:

function foo() {
  return 'bar';
}

I want to add a space between the function name and the parentheses.

function foo () {
  return 'bar';
}

Is there a configuration that would allow me to do that now? Here's what I've tried:

  "esformatter": {
    "whitespace": {
      "before": {
        "ParameterList": 1
      }
    }
  }

If the code doesn't support such a setting now, any ideas on how to add it? I poked around the code and it looks like it may have something to do with FunctionDeclaration.js, Params.js, or both.

pmcelhaney commented 8 years ago

Or how would I go about writing a plugin?

millermedeiros commented 8 years ago

the setting that you are looking for is whiteSpace.after.FunctionName = 1