- Recommend using Sourcetree client, but you can choose anything.
- We use GitHub flow for simplicity. Reason here. In short:
- Always branch from
master. - Name the branch accordingly, read below for more information.
- After passing all tests, ask for reviews.
- Merge back to
master. Enjoy productivity!
- Always branch from
- PR’s name format:
CODE-123-Descriptive-task-name-hereCODE: in our case, for example,THDPis for Triết Học Đường Phố.123: the code of the issue/task.Descriptive-task-name: Convert from task’s name.
- Commit messages should be descriptive and meaningful.
- Try to avoid “WIP”, “yup”, “Todo”, “Still not working” at all costs.
- Only commit related work. If you find a bug out of the current task’s scope, create a new task for it.
- Strictly follow the ESLint. We will use eslint-config-airbnb.
- If you want to change some rules, bring them to discuss with the team first.
- You have to pay 10,000€ for using the
eslint-disable-lineonce! - Try to avoid putting
console.loginto production if possible.
- Try to use names with meaningful words.
- Good:
const shouldDisableApplyButton = checkPermission(...)selectedItems.map((selectedItem: ListItem) => renderItem(selectedItem))
- Bad:
const disabled = checkDis(...)items.map(i => rItem(i))
- Good:
- Avoid complex one-liner code and nested ternary operators.
- Try to avoid using
stringdirectly. Embraceenum,constant, dictionarymap, etc.- Good:
const errorMessage = 'Something ...';thenthrow new Error(errorMessage); - Bad:
if (error) { console.log('Something wrong ...'); }
- Good:
- Avoid using
anyat all costs. Same withextendsobject,{}. - Avoid using
@ts-ignore. This line costs the sameeslint-disable-line! - Names should be descriptive and meaningful.
- Avoid
{ ctx: CT }. Should be:{ context: ContextType }
- Avoid
- We prefer to use
typerather thaninterfaceif possible. - Read more Do and Don’t from TypeScript documentation.
- We use react-testing-library with
Jest. - Avoid using
fireEventif possible, try to useuser-event - Try to cover behaviors instead of simply checking visuals.
- Read this blog to avoid common mistakes. This is really important.