General
Pre-commit hooks
On most projects multiple developers are working in pararell and also through time. Each one of them can be using a different editor with different setup. Quite quickly we can be breaking each others styling (formatting) and we don’t want that. To ensure that all code pushed to GIT repository is formatted the same way and at the same time support all text editors we can setup pre-commit hooks. This will be running linter and formatter before each commit.
Setup
Prettier
Use Prettier for formatting.
ESLint
Use ESLint to enforce code style and catch errors.
Why not ESLint for formatting?
Here is a really good talk about ESLint for React, but the same logic applies to other frameworks.
Guidelines
HTML
- Avoid using inline styles and instead use CSS classes for styling
- Use alt attributes for all images to improve accessibility
CSS
- TailwindCSS
Javascript
- Typescript
- Class/Interface/Type
- Use semicolon
Maintainance
Once a month for each project go throw all dependecies and check changelogs for ones, which have a newer version. Update them and fix breaking changes if needed. If one of them would take a considered amount of time, please talk about it with team lead or project manager.