web5-js icon indicating copy to clipboard operation
web5-js copied to clipboard

RFC: Adopt Prettier default config instead of eslint formatting rules

Open shamilovtim opened this issue 8 months ago • 0 comments

  • Start Date: 2023-11-07
  • RFC PR:

Summary

Encourage open source contributions and move toward community standard tooling by adopting Prettier as a formatter. Remove ad-hoc formatting rules from the eslint config.

Motivation

Eslint says it will no longer function as a formatter. As a new contributor I forked web5-js and made some changes. I went to format but I noticed that no formatter was configured. This was surprising because as a regular OSS contributor I haven't encountered many recent JS projects that don't use Prettier.

Drawbacks

  • Adding prettier adds a CI step to format all PRs
  • Contributors will need to be onboarded toward using Prettier and formatOnSave

Alternatives

  • There's dprint but for an open source project Prettier is standard

Adoption strategy

  • Add a .prettierrc to the project root. Use default prettier settings and singlequote { singleQuote: true }.
  • Remove eslint formatter rules
  • Bump eslint and plugins
  • Add a vscode workspace setting to use formatOnSave: true and selected formatter prettier
  • Add vscode recommended extension for Prettier
  • Add a CI step to check prettier formatting
  • Don't use eslint-prettier because it causes editor noise

shamilovtim avatar Nov 07 '23 19:11 shamilovtim