ubc-carnap-team / Rudolf

Truth Tree Widget for Carnap
2 stars 3 forks source link

Add a pre-commit hook to run prettier #40

Closed McTano closed 4 years ago

McTano commented 4 years ago

EDIT: Limit this to just a prettier hook for now, and leave the type-checking and linting for a pipeline which runs after push.

ORIGINAL: We should set up git hooks to run prettier, eslint --fix, and tsc on our repo each time we commit code. tsc errors or unfixable eslint errors should prevent the commit unless the checks are manually skipped.

lf- commented 4 years ago

Git client side hooks like these would need to be installed by some script in our repository as they reside in .git and do not come down with clones. Should we make a task with package.json that does this installation?

Also, if we are using client side hooks for this, we should potentially use CI (when we implement CI) to enforce that the code is compliant with the standards as it is not necessarily the case that everyone chooses to install the hooks.

McTano commented 4 years ago

We can use husky to make it part of the npm install process. That's the only way I've used them so I didn't really know about the limitations of doing it manually. The prettier docs have instructions for how to do it a couple of different ways. The husky + prettier-quick method seems good.

On Fri, Jun 12, 2020, 10:44 PM lf notifications@github.com wrote:

Git client side hooks like these would need to be installed by some script in our repository as they reside in .git and do not come down with clones. Should we make a task with package.json that does this installation?

Also, if we are using client side hooks for this, we should potentially use CI (when we implement CI) to enforce that the code is compliant with the standards as it is not necessarily the case that everyone chooses to install the hooks.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/McTano/Rudolf/issues/40#issuecomment-643574225, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEFHH6WJCP333OLHHYQHU7LRWMG47ANCNFSM4KI4YOJA .

lf- commented 4 years ago

Ah, ok. I haven't maintained this kind of thing in a JavaScript project before, only used it for circuit boards, so wasn't sure as to the tooling. Makes sense!