wcc icon indicating copy to clipboard operation
wcc copied to clipboard

add Prettier formatting to the project

Open thescientist13 opened this issue 1 year ago • 2 comments

Type of Change

Chore

Summary

As new contributions are coming into the project, it would be good to formalize the formatting style and expectations for the project, and for that it would probably a good idea to add Prettier to the project.

There's an example we can follow from the Greenwood website that I implemented that we can follow https://github.com/ProjectEvergreen/www.greenwoodjs.dev

Details

A couple notes regarding the above reference repo

  • I opted to incorporate husky for managing pre-commit hooks, but I am OK if we just want to just have it so contributors manually run prettier format locally.
  • Either way, we should still have prettier format run on CI as part of our GitHub Actions flow
  • We should probably also upgrade to ESLint to the latest version and make sure it has any prettier overlapping rules disabled. Here's that's project's ESLint config for reference (we don't need the markdown configuration though)
  • We should add a note to the CONTRIBUTING.md with whatever workflow we end up with

As we have a few PRs and release in active development, my recommendation would be to wait until all those PRs land first, or just do it as the first change once we cut the v0.16.0 release https://github.com/ProjectEvergreen/wcc/issues?q=label%3A0.16.0+

thescientist13 avatar Dec 02 '24 17:12 thescientist13

@briangrider I know we had chatted about this one, so just mentioning you here in case you were interested in contributing the change.

thescientist13 avatar Dec 02 '24 17:12 thescientist13

Ok, great. Yes, definitely up for helping with this but agree that we can wait until we get all of the other good stuff we've been talking about in there

briangrider avatar Dec 04 '24 21:12 briangrider

Looks like v0.16 is finished. Is this ready to be picked up?

KaiPrince avatar Nov 05 '25 18:11 KaiPrince

sure! feel free to review the Greenwood repo for our settings / implementation if you need a reference to get started. 👍

thescientist13 avatar Nov 06 '25 02:11 thescientist13

I'm thinking of doing this in three PRs:

  1. Install prettier
  2. Prettier format all files
  3. Add CI check and maybe git hook

KaiPrince avatar Nov 08 '25 08:11 KaiPrince

@KaiPrince it's fine to do this all in one PR 👍

Don't forget to account for lint-staged / husky so these linting / formatting checks can be run on git commit.

thescientist13 avatar Nov 08 '25 13:11 thescientist13

Oh okay, I was mainly planning to split it because prettier is gonna format a whole bunch of files, and I know you're a guy who prefers keeping diffs lean in each PR. Anyhow I've added the rest into the one PR so it's ready for you to take a look.

Also I've run across an issue with self closing (void) tags, so I'll open a separate issue for that, which is gonna block this one.

KaiPrince avatar Nov 08 '25 21:11 KaiPrince

See https://github.com/ProjectEvergreen/wcc/issues/210

KaiPrince avatar Nov 08 '25 22:11 KaiPrince