方法论
数据请求都从页面发起,组件简单,页面相对复杂,但容易应对任何变动,不会再有状态提升问题。
为了保证这一点,需要全局命名统一、方便搜索,页面尽量用hooks
拆分。
参数默认值
WARNING
参数默认值设计很重要,一个例子是机器人消息发送人默认是全部,其实就不应该,太打扰用户了
方案
做事之前想好背景,为什么做,有什么痛点?
实行之前充分调研,为什么这么做,社区有什么开源方案,为什么不直接用?
glob 星号
*
(单星号) 的用法:
- 匹配任意数量的字符(包括零个字符)
- 不匹配路径分隔符 (/ 或 \,取决于操作系统)
- 通常用于匹配单个路径段中的文件名或目录名
**
(双星号) 的用法
- 匹配任意数量的字符 包括路径分隔符
- 用于递归匹配任意深度的子目录
ti18n 词条提取
- 执行 ti18n -ET,词条提取并进行词条包裹操作
- 执行 ti18n -Et, 已标记词条提取
查找命名有问题的文件
- 查找包括大写字母的文件
bash
find ./src -type f -regex '.*/.*[A-Z].*' -not -path "./src/component/*" -not -path "./src/api/*" -not -path "*dist/*" -not -path "./src/library/*"
- 查找包括大写字母的文件夹
bash
find ./src -type d -regex '.*/.*[A-Z].*' -not -path "./src/component/*" -not -path "./src/api/*" -not -path "*dist/*" -not -path "./src/library/*"
查找 js/ts 文件
找js/ts
文件
bash
find ./src -type f -regex ".*\.[jt]s$" -not -path "./src/component/*" -not -path "./src/api/*" -not -path "*dist/*" -not -path "./src/library/*"
找js
文件
bash
find ./src -type f -regex ".*\.js$" -not -path "./src/component/*" -not -path "./src/api/*" -not -path "*dist/*" -not -path "./src/library/*"
# or
find ./src -type f -name "*.js" -not -path "src/component/*" | wc -l
找ts
文件
bash
find ./src -type f -regex ".*\.ts$" -not -path "./src/component/*" -not -path "./src/api/*" -not -path "*dist/*" -not -path "./src/library/*"