@@ -18,13 +18,14 @@ 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 | -- | 运行列出的脚本 |
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\> | 检查代码并尝试修复 |
28
29
29
30
## API
30
31
@@ -35,6 +36,7 @@ npm i -g code-genius
35
36
| 3 | ` cleanUp(paths) ` | ` paths: string[] ` | ` Promise<void> ` |
36
37
| 4 | ` gitInitSimpleHooks(cwd) ` | ` cwd?: string ` | ` Promise<void> ` |
37
38
| 5 | ` npmRun(cwd) ` | ` cwd?: string ` | ` Promise<void> ` |
39
+ | 6 | ` eslintFix(cwd, options) ` | ` cwd?: string ` ,` options:(EsLintOptions) ` | ` Promise<void> ` |
38
40
39
41
## API 示例
40
42
@@ -98,6 +100,18 @@ npmRun(cwd);
98
100
npx esno index .ts
99
101
```
100
102
103
+ eslintFix()
104
+
105
+ ``` typescript
106
+ // ./index.ts
107
+ import { eslintFix , cwd , esLintOptions } from " code-genius" ;
108
+
109
+ await eslintFix (cwd , { eslintrc , paths: path });
110
+
111
+ // 运行
112
+ npx esno index .ts
113
+ ```
114
+
101
115
## 执照
102
116
103
117
MIT License
0 commit comments