@@ -18,14 +18,15 @@ npm i -g code-genius
18
18
19
19
## 终端命令
20
20
21
- | 命令 | 参数 | 功能描述 |
22
- | ------ | ---------------------------------------------- | ---------------------------------------------- |
23
- | cm | --noEmoji | 帮助生成规范的 git 提交内容 |
24
- | cmv | -- | 帮助验证 git commit 的内容是否符合规范 |
25
- | cup | --ignore \< path\> | 清理运行时生成的文件 |
26
- | ihooks | -- | 使用且有修改 simple-git-hooks 后需要重新初始化 |
27
- | run | -- | 运行列出的脚本 |
28
- | lint | --eslintrc \< file\> , --path \< path\> , --staged, --suffix \< suffix\> | 检查代码并尝试修复 |
21
+ | 命令 | 参数 | 功能描述 |
22
+ | -------- | ------------------------------------------------------------------- | ---------------------------------------------- |
23
+ | cm | --noEmoji | 帮助生成规范的 git 提交内容 |
24
+ | cmv | -- | 帮助验证 git commit 的内容是否符合规范 |
25
+ | cup | --ignore \< path\> | 清理运行时生成的文件 |
26
+ | ihooks | -- | 使用且有修改 simple-git-hooks 后需要重新初始化 |
27
+ | run | -- | 运行列出的脚本 |
28
+ | lint | --eslintrc \< file\> , --path \< path\> , --staged, --suffix \< suffix\> | 检查代码并尝试修复 |
29
+ | prettier | --path \< path\> , --staged, --suffix \< suffix\> | 格式化代码高风格 |
29
30
30
31
## API
31
32
@@ -37,6 +38,7 @@ npm i -g code-genius
37
38
| 4 | ` gitInitSimpleHooks(cwd) ` | ` cwd?: string ` | ` Promise<void> ` |
38
39
| 5 | ` npmRun(cwd) ` | ` cwd?: string ` | ` Promise<void> ` |
39
40
| 6 | ` eslintFix(cwd, options) ` | ` cwd?: string ` ,` options:(EsLintOptions) ` | ` Promise<void> ` |
41
+ | 7 | ` prettierFormat(cwd, options) ` | ` cwd?: string ` ,` options:(PrettierFormatOptions) ` | ` Promise<void> ` |
40
42
41
43
## API 示例
42
44
@@ -112,6 +114,18 @@ await eslintFix(cwd, esLintOptions);
112
114
npx esno index .ts
113
115
```
114
116
117
+ prettierFormat()
118
+
119
+ ``` typescript
120
+ // ./index.ts
121
+ import { prettierFormat , cwd , prettierFormatOptions } from " code-genius" ;
122
+
123
+ await prettierFormat (cwd , prettierFormatOptions );
124
+
125
+ // 运行
126
+ npx esno index .ts
127
+ ```
128
+
115
129
## 执照
116
130
117
131
MIT License
0 commit comments