Skip to content

Framework: Use Prettier? #12260

@samouri

Description

@samouri

Over the past few weeks, the prettier javascript auto-formatter has come up many times in calypso-framework chat. For anyone who wants a fun introduction to what prettier is, feel free to watch the creators lightning talk at ReactConf: https://www.youtube.com/watch?v=hkfBvpEfWdA

tldw:

  • Prettier auto-formats your code so you don't need to (DevEx++). A linter like eslint cannot reliably fix style issues (and also doesn't ensure standard formatting around things like linebreaks).
  • It reduces the learning curve for new OSS contributors
  • It acts as a teaching tool by wrapping expressions according to javascript's order of operations
  • React, Immutable, jest, babel, and more are all using it (prettier is well tested)
  • It is not very configurable. We would need to give up our WP/PHP inspired spacing conventions and break with WP Core JS Guidelines. We would need to modify our eslint config to conform to prettier. e.g. eslint-plugin-prettier.
  • The initial "run prettier" commit would mess with our git blame. GitHub makes it pretty easy to skip around blame history

I think we all know that we could debate styles until the end of time, so I figure lets just call for a vote and be done with it. Should we spin up a PR that formats all of calypso, modifies our eslint style rules, and updates our docs?

Thumbs up for yes, thumbs down for no.

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