# Coding Standard
# ESlint
Most of the standard is defined in eslint so you get
auto fixing by default. Please ensure you turned on file watcher
feature in webstorm to auto run eslint --fix on file change.
See devtool setup.
# Additional standard
# 1. Error
Error should extend VersedError class. You can extend one of
the subclass in mod/errors.
The VersedError have the following properties:
class VersedError {
code: string; // a unique identifier of this type of error
message: string;
status: number; // e.g. 500 for internal server error
data: object; // any extra data you want to log
}
We will also support error translation by using the code and data
# 2. Git commit message
Git commit must be the following format:
TYPE(SCOPE): DESCRIPTION
SCOPE: the related module you are modifying (e.g. base, auth, chore)TYPE: the action of this commit, must be one of the following:feat- Adding or Changing things for a featurerefactor- Changing code without changing the behavior of the appfix- Fix a bug/issuedoc- updating documentation
DESCRIPTION: the description of your commit
Example commit message:
doc(base): update development standard
feat(ci): auto deploy documentation
fix(user): listUser() should not return banned users by default
refactor(user): move xxx functions to utils
# 3. Git branch name
Git branch must be the following format:
TYPE/SCOPE-ISSUE_ID-DESCRIPTION
TYPE: the type of this branch, must be one of the following:feat- This branch is for a featurerefactor- This branch is to refactor a modulefix- Fix a bug/issueexp- This branch is an experimentdoc- This branch is for documentation (We don't advice to do documentation independently, instead, document it while you are developing)
SCOPE: the related module you are modifying (e.g. base, auth, chore)ISSUE_ID: (optional) the jira/github/gitlab issue this branch is solvingDESCRIPTION: the short description of this branch
Example branch name:
feat/user-#11-support-google-login
fix/user-PTC-72-sometime-user-logged-out
exp/user-replace-redis-with-memcache
# Naming convention
- source files should be in
kebab-case.filetype.ts. - if the file contains only one class, name it in
CamelCase.ts - for markdown should be in
snake_case.md