Problems:
- People feel demotivated
- Lower productivity
- Team doesn't grow
Solutions:
- Decide what the convention will be (everyone votes, then it can't be brought up again for 3 months)
- Lint EVERYTHING
- Pre-commit linting with lint-staged, yorkie (fork of husky)
- Run related unit tests on pre-commit (
--findRelated
with Jest) - Always find some room for improvement, even if it doesn't prevent the code from being merged.
Problems:
- Someone not sure about the steps involved, e.g. to add a page
- Not writing tests, when they know they should
- Not following other conventions that can't be caught by a linter
Solutions:
- Use generators with Hygen
- Workspace snippets in VS Code
- Internal docs (have new people read through your internal docs and ask questions, before getting a walkthrough)
- In-line comments (but first, see if you could re-write the code in a way that doesn't require a comment)
- Use Cypress for end-to-end tests (much friendlier dev experience)
Problems:
- A new dev asked me once after a week of my code reviews, "Do you hate me?" because I always found areas for improvement. Now, that's not a problem - that's what helps the team grow.
Solutions:
- Use a lot of emoji - it's better to come across as weird than mean
- Ask questions, rather than assuming fault
- Let nitpicks go if they won't ever result in a bug, difficult to figure out, difficult to maintain, very likely to require a major refactor very soon