codu icon indicating copy to clipboard operation
codu copied to clipboard

Adding to precommit hooks

Open garyb1 opened this issue 2 years ago • 6 comments

Open question about precommit hooks. We can create individual PR's if we agree.

  • Unit Tests? Obviously need to improve testing as a whole but it can be good to ensure tests are ran.
  • Linting with Eslint - We have a lint script but it does not get activated yet. Need another ticket to address linting issues. Mainly a11y and TS errors/warnings.
  • Markdown spellcheck
  • JSHint
  • CSS Linting: A CSS linter that helps you avoid errors and enforce conventions.
  • Commitlint helps your team adhere to a commit convention.

Feel free to comment below.

garyb1 avatar Nov 24 '23 15:11 garyb1

Some amazing ideas here!

This is a preference because I like people to commit early and often (even if it's not 100%). However, pull requests should not be merged without these checks passing.

My preference for these things would be individual GitHub actions that confirm these things when a pull request is opened.

Things we could start with immediately:

  • ESLint
  • TypeScript
  • Prettier
  • Tests

Which should block PRs from being merged.

And for the rest:

  • The Markdown spellcheck seems like a great idea.
  • JSHint seems to no longer be supported and has no recent activity, so I don't think I'd be in favor (unless there is something amazing we will miss)
  • On CSS linting, is there something here that Prettier can't do, or should we just enforce prettier rules on PRs?
  • Commitlint seems great, I would probably break that into a separate issue/discussion to argue on semantics. 😂

We could start with a warning (like a nice to have) until we have some firm docs and decisions.

NiallJoeMaher avatar Nov 24 '23 15:11 NiallJoeMaher

I would love to explore this issue, starting with the items suggested as I want to learn more about GitHub actions (I also prefer the light commit approach)

sonngdev avatar Nov 27 '23 23:11 sonngdev

we should update when possible so builds can pass when deploying in vercel,

xiaoniuniu89 avatar Dec 12 '23 12:12 xiaoniuniu89

@xiaoniuniu89 what updates are needed? 🤔 I'll get it added to the top of my pile.

NiallJoeMaher avatar Dec 12 '23 12:12 NiallJoeMaher

will be nice to prevent commit if lint fails, that was problem with my last pr.

xiaoniuniu89 avatar Dec 12 '23 12:12 xiaoniuniu89

I caught it from running npm run build

xiaoniuniu89 avatar Dec 12 '23 12:12 xiaoniuniu89