Skip to content

Space after function keyword - MOVED to #3847! #1139

@sparty02

Description

@sparty02

I apologize in advance if this has been discussed before (I did a quick search and didn't find it). One of the things that popped out when running prettier over our codebase was spacing on anonymous functions.

For example, prettier converts this:

function foo() {
  this.bar = function () {
    console.log('baz');
  }
}

into this:

function foo() {
  this.bar = function() {
    console.log('baz');
  }
}

While this pattern is becoming less common for us (we'd probably use an arrow function here now), we still have several cases of this. The lack of space after the function keyword just doesn't read right for me. It probably has to do with one or more of the following:

  1. It looks more like a function invocation than a declaration.
  2. The lack of space after a keyword is odd.

For prior art:

Are there strong feelings on this one?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions