Skip to content

Commit 8ef0d01

Browse files
committed
docs(docs): 更新
1 parent 8ad14ce commit 8ef0d01

File tree

1 file changed

+21
-18
lines changed

1 file changed

+21
-18
lines changed

README.md

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,26 @@
44

55
使用场景: 用于通过 `simple-import-sort` 插件来对导入模块进行排序且未直接配置插件到 `.eslintrc` 情况.
66

7+
8+
## 安装
9+
10+
``` bash
11+
npm i @codegenius/impsort-plugin -D
12+
```
13+
14+
```javascript
15+
import { defineConfig } from "code-genius";
16+
import { impSortInstaller } from "@codegenius/impsort-plugin";
17+
18+
export default defineConfig({
19+
plugins: [
20+
impSortInstaller(),
21+
],
22+
});
23+
```
24+
25+
## 使用
26+
727
### 命令模式
828

929
```bash
@@ -34,28 +54,11 @@ codeg impsort --ask
3454
### API 模式
3555

3656
```typescript
37-
import { impSort } from "../src/index";
57+
import { impSort } from "@codegenius/impsort-plugin";
3858

3959
(async () => {
4060
await impSort(["./src"]);
4161
})();
4262
```
4363

4464
PS: 依赖 `eslint` API 模式, 依赖 `simple-import-sort` 插件的同时依旧会读取项目配置的 `.eslintignore``.eslintrc.json` 文件, 使用 `impsort` 的同时将同步进行 `fix` 检测和修复.
45-
46-
### 配置文件
47-
48-
```typescript
49-
# 覆盖默认的 `impsort` 配置
50-
import { defineConfig } from "code-genius";
51-
52-
export default defineConfig({
53-
commands: {
54-
format: {
55-
impsort: ["./src", "./scripts"],
56-
},
57-
},
58-
});
59-
```
60-
61-

0 commit comments

Comments
 (0)