Skip to content

FE-CodeGenius/codegenius-format-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

d0ac046 · Oct 10, 2023

History

15 Commits
Oct 9, 2023
Oct 10, 2023
Oct 8, 2023
Oct 8, 2023
Oct 8, 2023
Oct 8, 2023
Oct 10, 2023
Oct 8, 2023
Oct 9, 2023
Oct 10, 2023
Oct 10, 2023
Oct 10, 2023
Oct 8, 2023
Oct 10, 2023
Oct 8, 2023

Repository files navigation

@codegenius/format-plugin

运行 prettier 格式化代码风格, 仅支持命令模式;

使用场景: 用于替代 prettier --write, 功能雷同, 可以使用 API 模式来运行命令.

安装

npm i @codegenius/format-plugin -D
import { defineConfig } from "code-genius";
import { prettierFormatInstaller } from "@codegenius/format-plugin";

export default defineConfig({
  plugins: [
    prettierFormatInstaller({
      files: ["./src", "./scripts"],
    }),
  ],
});

使用

命令模式

# 格式化 src 文件夹下的文件
codeg format
# 格式化 src 和 components 文件夹下的文件
codeg format -p ./src -p ./components
选项 描述
-p, --pattern <pattern> 设置匹配规则

PS: 依赖 prettier CLI 模式, 同时对项目配置的 .prettierignore.prettierrc.json 生效.

About

运行 prettier 格式化代码风格

Resources

License

Stars

Watchers

Forks

Packages

No packages published