@minimalstuff /工具
共享工具配置:EditorConfig, OXC (oxlint + oxfmt), Knip。CLI在项目中设置它们。
要求
- 节点>= 26
oxlint> = 1.89.0,oxfmt>= 0.74.0和oxlint-tsgolint>= 7.0.2004(可选的对等依赖,用于OXC预设)knip>= 6.42.1(可选的对等依赖,用于Knip预设)@adonisjs/eslint-plugin^2.2.2(可选的对等依赖,需要与adonisjs: true在oxlint预设中;命令行安装它)
版本控制
[!重要的) 删除或更改导出或选项是破坏性更改。1.0之前,new或strict
error-级别的规则和新的需要的对等依赖也被打破了:它们在一个小版本中发布,其中^0.x范围永远不会自动增加。新warn严格的规则和宽松的规则都没有违反。
建立一个项目
使用CLI
在交互式终端中,从项目根目录运行以下命令:
pnpm dlx @minimalstuff/tooling@latest
命令行询问要设置哪些工具(EditorConfig, OXC, Knip),在选择OXC时提供VS Code设置,并要求预置(react, adonisjs, vitest)从依赖项中预先选择。它在覆盖文件之前进行询问,并且只添加 package.json 缺少的脚本。然后使用检测到的包管理器将这些包作为devDependencies安装一次。看到 CLI参考 获取详细信息。
手动
pnpm add -D oxlint oxfmt oxlint-tsgolint @minimalstuff/tooling
# optional, for the AdonisJS oxlint preset
pnpm add -D @adonisjs/eslint-plugin
# optional, for the Knip preset
pnpm add -D knip
// oxlint.config.ts
import { minimalstuffPreset } from '@minimalstuff/tooling/oxc/lint';
export default minimalstuffPreset({ react: true });
// oxfmt.config.ts
import { minimalstuffPreset } from '@minimalstuff/tooling/oxc/fmt';
export default minimalstuffPreset();
// knip.ts
import { minimalstuffPreset } from '@minimalstuff/tooling/knip';
export default minimalstuffPreset();
cp node_modules/@minimalstuff/tooling/preset/.editorconfig .editorconfig
看到 预设的参考 选项。
开发
pnpm install
pnpm checks
pnpm checks 运行类型检查、lint、格式检查、Knip、单元测试和构建。 pnpm test:package 使用严格的pnpm将打包好的tarball安装到一次性的消费者项目中:它需要网络访问并在CI中运行。