File tree Expand file tree Collapse file tree 1 file changed +38
-2
lines changed
Expand file tree Collapse file tree 1 file changed +38
-2
lines changed Original file line number Diff line number Diff line change 1- # codegenius-format-plugin
2- 运行 prettier 格式化代码风格
1+ # @codegenius/format-plugin
2+
3+ 运行 ` prettier ` 格式化代码风格, 仅支持命令模式;
4+
5+ 使用场景: 用于替代 ` prettier --write ` , 功能雷同, 可以使用 ** API** 模式来运行命令.
6+
7+ ### 命令模式
8+
9+ ``` bash
10+ # 格式化 src 文件夹下的文件
11+ codeg format
12+ ```
13+
14+ ``` bash
15+ # 格式化 src 和 components 文件夹下的文件
16+ codeg format -p ./src -p ./components
17+ ```
18+
19+ | 选项 | 描述 |
20+ | ------------------------- | ------------ |
21+ | -p, --pattern \< pattern\> | 设置匹配规则 |
22+
23+ PS: 依赖 ` prettier ` CLI 模式, 同时对项目配置的 ` .prettierignore ` 和 ` .prettierrc.json ` 生效.
24+
25+ ### 配置文件
26+
27+ ``` typescript
28+ # 覆盖默认的 ` format ` 配置
29+ import { defineConfig } from " code-genius" ;
30+
31+ export default defineConfig ({
32+ commands: {
33+ format: {
34+ paths: [" ./src" , " ./scripts" ],
35+ },
36+ },
37+ });
38+ ```
You can’t perform that action at this time.
0 commit comments