Skip to content

Can we use Prettier (or similar formatter) for Javascript code? #16115

Closed
@trivikr

Description

@trivikr

Can we use Prettier for formatting Javascript code in NodeJS?
Prettier is an opinionated code formatter. It removes all original styling and ensures that all outputted code conforms to a consistent style.

Reasons:

  • Right now there are 1600 contributors in NodeJS repository (thanks to its huge popularity), but every Javascript developer has their own style of formatting.
  • Some code is difficult to read because of manual formatting. Prettier will ensure that such issue will not occur.

We recently started using Prettier for private projects, and life has been better. We don't worry/argue about formatting any more :-)
Of course there was initial oppositions to some of the decisions taken by Prettier (like lack of parenthesis around single param arrow functions), but we got used to it with time.
For Open Source projects which don't use Prettier, I manually run Prettier CLI for the files which I'm editing. I believe developers will be more productive if we use formatters like Prettier in NodeJS. What do you think?

Metadata

Metadata

Assignees

No one assigned

    Labels

    metaIssues and PRs related to the general management of the project.questionIssues that look for answers.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions