From bf71b311239478f779f42c63e30b2e694f6c25db Mon Sep 17 00:00:00 2001 From: syuilo Date: Wed, 17 Apr 2019 16:59:39 +0900 Subject: [PATCH] Update CONTRIBUTING.md --- CONTRIBUTING.md | 36 +++++++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6825225e0..edc6244d3 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -46,10 +46,40 @@ Convert な(na) to にゃ(nya) Revert Nyaize ## Code style -### Use semicolon -To avoid ASI Hazard +### セミコロンを省略しない +ASI Hazardを避けるためでもある + +### 中括弧を省略しない +Bad: +``` ts +if (foo) + bar; +else + baz; +``` + +Good: +``` ts +if (foo) { + bar; +} else { + baz; +} +``` + +ただし**`if`が一行**の時だけは省略しても良い +Good: +``` ts +if (foo) bar; +``` + +### `export default`を使わない +インテリセンスと相性が悪かったりするため + +参考: +* https://gfx.hatenablog.com/entry/2017/11/24/135343 +* https://basarat.gitbooks.io/typescript/docs/tips/defaultIsBad.html -### Don't use `export default` Bad: ``` ts export default function(foo: string): string {