File tree Expand file tree Collapse file tree 1 file changed +21
-18
lines changed
Expand file tree Collapse file tree 1 file changed +21
-18
lines changed Original file line number Diff line number Diff line change 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
4464PS: 依赖 ` 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-
You can’t perform that action at this time.
0 commit comments