Biome 配置

Biome 代码检查和格式化配置

安装

npx shadcn@latest add https://ssp-ui-registry-staging.sh3.agoralab.co/r/biome-rules.json
yarn dlx shadcn@latest add https://ssp-ui-registry-staging.sh3.agoralab.co/r/biome-rules.json
pnpx shadcn@latest add https://ssp-ui-registry-staging.sh3.agoralab.co/r/biome-rules.json
bunx shadcn@latest add https://ssp-ui-registry-staging.sh3.agoralab.co/r/biome-rules.json

框架适配

Next.js 项目:添加 next domain

{
  "linter": {
    "domains": {
      "next": "recommended",
      "react": "recommended"
    }
  }
}

TanStack 项目:默认配置即可(仅 react domain)

特性

  • useSortedClasses:自动排序 Tailwind CSS 类名
  • organizeImports:自动整理 import 语句
  • tailwindDirectives:支持 @tailwind 等指令

使用

package.json 示例:

{
  "scripts": {
    "lint": "biome check --write"
  }
}

参考

目录