Skip to content

Commit 934dac6

Browse files
authored
docs: Update AGENTS.md (#176)
1 parent 8008a9d commit 934dac6

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

AGENTS.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,13 @@ if(...) {
101101
// ...
102102
}
103103
```
104+
- 对于复杂的条件判断,采用if语句“提早退出”策略,且如果if的条件语句较短,可以将return直接跟在同一行结尾,不用写大括号,如:
105+
```ts
106+
useEffect(() => {
107+
if(!client) return; // return直接跟在同一行结尾
108+
// ...
109+
}, [client, /*...*/]);
110+
```
104111

105112
### 代码规范
106113

0 commit comments

Comments
 (0)