Skip to content

Commit e5eec70

Browse files
committed
docs(feature): 更新lint使用说明
1 parent 1ec60b1 commit e5eec70

File tree

1 file changed

+21
-7
lines changed

1 file changed

+21
-7
lines changed

README.md

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,14 @@ npm i -g code-genius
1818

1919
## 终端命令
2020

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\> | 检查代码并尝试修复 |
2829

2930
## API
3031

@@ -35,6 +36,7 @@ npm i -g code-genius
3536
| 3 | `cleanUp(paths)` | `paths: string[]` | `Promise<void>` |
3637
| 4 | `gitInitSimpleHooks(cwd)` | `cwd?: string` | `Promise<void>` |
3738
| 5 | `npmRun(cwd)` | `cwd?: string` | `Promise<void>` |
39+
| 6 | `eslintFix(cwd, options)` | `cwd?: string`,` options:(EsLintOptions)` | `Promise<void>` |
3840

3941
## API 示例
4042

@@ -98,6 +100,18 @@ npmRun(cwd);
98100
npx esno index.ts
99101
```
100102

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+
101115
## 执照
102116

103117
MIT License

0 commit comments

Comments
 (0)