Matico-Platform / matico

An open source platform for building civic tech and geospatial apps
https://matico.app
46 stars 3 forks source link

Setup husky + Prettier / cargo fmt for the monorepo #211

Closed stuartlynn closed 1 year ago

stuartlynn commented 1 year ago

What I have used in the past which has worked pretty well is

While we are thinking about dev tooling as well, it might be worth considering using something akin to comittizen to standardize commit messages and make it easier to produce release notes in future.

michplunkett commented 1 year ago

I think we could take this in a couple of steps, but I think comittizen is something we could eventually get in. I'll break this task down on Friday.

michplunkett commented 1 year ago

I'll try to approach this in a couple of distinct PRs so that all changes are isolated:

  1. Install Prettier in the code base
  2. Run Prettier on TypeScript
  3. Run Prettier on Rust
  4. Install Husky
  5. Configure Husky for the pre-commit hooks

This pathway obviously relies on Prettier being able to run on Rust, which it should, but should that not be the case I'll add 2 PRs for installing the Rust Prettier equivalent and then running it on the Rust code base.

stuartlynn commented 1 year ago

Sounds good to me. If prettier can't do rust well enough we should be able to just use "cargo fmt" which comes as standard with cargo the rust package manager.

Just a quick note to say because we have this setup as a monorepo, you prob want to install all of this at the root level, ie in the package.json in the root directory.

michplunkett commented 1 year ago

Yup, the root level is where I'm installing it! Given that I went with Google's TypeScript formatter, I think I'll be using cargo fmt.

michplunkett commented 1 year ago

With the merging of https://github.com/Matico-Platform/matico/pull/222, this PR is done.