add Prettier formatting to the project
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 formatlocally. - Either way, we should still have
prettier formatrun 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+
@briangrider I know we had chatted about this one, so just mentioning you here in case you were interested in contributing the change.
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
Looks like v0.16 is finished. Is this ready to be picked up?
sure! feel free to review the Greenwood repo for our settings / implementation if you need a reference to get started. 👍
I'm thinking of doing this in three PRs:
- Install prettier
- Prettier format all files
- Add CI check and maybe git hook
@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.
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.
See https://github.com/ProjectEvergreen/wcc/issues/210