Skip to content

Parenthesis around single arguments in arrow functions #281

@jamiebuilds

Description

@jamiebuilds

Always use parentheses around the arguments. Omitting the parentheses makes the functions less readable and only works for single arguments.

Why? These declarations read better with parentheses. They are also required when you have multiple parameters so this enforces consistency.

 // bad
 [1, 2, 3].map(x => x * x);

 // good
 [1, 2, 3].map((x) => x * x);

This stuck out to me as odd. It's an intentional part of the spec to make it more readable for simple cases.

Anyways, I'm interested in discussing this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions