mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-25 03:17:38 -07:00
Update CONTRIBUTING.md
This commit is contained in:
parent
9f363d253d
commit
4d41016c10
1 changed files with 33 additions and 3 deletions
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue