# Coding Style ### Tools * 使用 eslint+husky,推 code 上來時不能有 warning/error * eslint 會有固定的模板供下載:(待補) * commit 訊息一律使用 [cz-cli](https://github.com/commitizen/cz-cli) * git commit 會改成 git cz * 如果有修 issue,則要填上對應的 issue 編號(cz 內建功能) * commit 訊息要考慮 domain * feat(core/input): implement input via design draft * feat(react/input): implement input component * fix(react/checkbox): ... ### Rules * **(eslint)** 中文、英文之間會空一格。比如:「遵守 eslint rules 就對了」 * **(eslint)** 「:」後面一定要空一格,「{」的左邊一定空一格,「)」右邊一定空一格,「(」左邊一定空一格。ex: `Object: { hi: (1) }` * 三元判斷式請盡量使用「正面表述」 * 正確方式:isValid ? null : dom * 錯誤方式:!isValid ? dom : null * 使用到 API 或後端針對資料庫的操作,嚴禁使用 spread `...` 這種寫法,這樣會有非常多未經預期的資料被塞進去,SQL Injection 就是這種操作下的產物,有多少參數就自己寫一對一展開。除了安全性問題外,這樣的寫法會讓 git 這種以行為單位的 version control 在做 diff 時更能看出每次 commit 的修改內容。 * 後端一定不行 * 前端只要使用 ts 就可以 ###### tags: `Basics`
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up