Loading...
Loading...
Compare original and translation side by side
| Mode | Trigger | Description |
|---|---|---|
| sync | No mode or | Quick overlap check (migrate) or nursery/feature check (modernize). |
| audit | | Full analysis with performance data, coverage stats, migration/modernization checklist. |
| update | | Refresh mapping and version reference files from upstream sources. |
| 模式 | 触发方式 | 描述 |
|---|---|---|
| sync | 无模式或 | 快速重叠检查(迁移场景)或nursery/功能检查(现代化改造场景)。 |
| audit | | 完整分析,包含性能数据、覆盖率统计、迁移/现代化改造清单。 |
| update | | 从上游源刷新规则映射和版本参考文件。 |
references/docs.md/biomejs/website/oxc-project/website/websites/viteplus_devreferences/docs.md/biomejs/website/oxc-project/website/websites/viteplus_devAskUserQuestionAskUserQuestionundefinedundefined
**Vite+ detection:** If `vite.config.ts` exists, check if it imports from `'vite-plus'`. Also check `package.json` for `vite-plus` in dependencies. If Vite+ is in use, its `lint` and `fmt` blocks in `vite.config.ts` **replace** standalone `.oxlintrc.json` and `.oxfmtrc.json`. Set `$VITEPLUS=true` and treat Oxc config as found.
```bash
**Vite+检测:** 若存在`vite.config.ts`,检查是否从`'vite-plus'`导入。同时检查`package.json`的依赖中是否包含`vite-plus`。若使用Vite+,则`vite.config.ts`中的`lint`和`fmt`区块**替代**独立的`.oxlintrc.json`和`.oxfmtrc.json`。设置`$VITEPLUS=true`并视为已找到Oxc配置。
```bashundefinedundefined| ESLint/Prettier | Biome | Oxc/Vite+ | Workflow |
|---|---|---|---|
| Found | Found | - | Migrate to Biome |
| Found | - | Found | Migrate to Oxc |
| Found | Found | Found | Ask user which target |
| Found | - | - | Ask user which target to migrate to |
| - | Found | - | Modernize Biome |
| - | - | Found | Modernize Oxc |
| - | Found | Found | Modernize both (ask which first) |
| - | - | - | Nothing to do — inform user |
$VITEPLUS=truelintfmtvite.config.tsWhich tool would you like to migrate to?
1. Biome (Recommended) — All-in-one linter + formatter, single config file
2. Oxc (Oxlint + Oxfmt) — Separate linter and formatter, ESLint-compatible rule names
3. Skip — Don't migrate, just show the analysis| 存在ESLint/Prettier | 存在Biome | 存在Oxc/Vite+ | 工作流类型 |
|---|---|---|---|
| 是 | 是 | 否 | 迁移至Biome |
| 是 | 否 | 是 | 迁移至Oxc |
| 是 | 是 | 是 | 询问用户选择目标工具 |
| 是 | 否 | 否 | 询问用户选择迁移目标 |
| 否 | 是 | 否 | 现代化改造Biome |
| 否 | 否 | 是 | 现代化改造Oxc |
| 否 | 是 | 是 | 现代化改造两者(询问优先顺序) |
| 否 | 否 | 否 | 无操作 — 告知用户 |
$VITEPLUS=truevite.config.tslintfmt您希望迁移至哪个工具?
1. Biome(推荐) — 一体化代码检查器+格式化工具,单一配置文件
2. Oxc(Oxlint + Oxfmt) — 分离式检查器与格式化工具,兼容ESLint规则命名
3. 跳过 — 不执行迁移,仅展示分析结果pnpm exec eslint --version 2>/dev/null || npx eslint --version 2>/dev/nullpnpm exec eslint --version 2>/dev/null || npx eslint --version 2>/dev/null
Read the appropriate mapping and check version staleness:
- Biome: `references/biome-eslint-mapping.json` → `_meta.biomeVersion`
- Oxc: `references/oxc-eslint-mapping.json` → `_meta.oxlintVersion`
Compare installed version against `_meta` version. If installed is newer, warn that mappings may be stale and suggest running `update` mode.
读取对应规则映射文件并检查版本是否过时:
- Biome: `references/biome-eslint-mapping.json` → `_meta.biomeVersion`
- Oxc: `references/oxc-eslint-mapping.json` → `_meta.oxlintVersion`
对比已安装版本与`_meta`中的版本。若已安装版本更新,需警告映射文件可能过时,并建议运行`update`模式。bash scripts/get-eslint-rules.sh
bash scripts/get-biome-rules.sh # or get-oxlint-rules.shbash scripts/get-eslint-rules.sh
bash scripts/get-biome-rules.sh # 或 get-oxlint-rules.shcat references/biome-eslint-mapping.json # or oxc-eslint-mapping.json
cat references/type-aware-rules.jsonreferences/oxc-defaults.jsoncat references/biome-eslint-mapping.json # 或 oxc-eslint-mapping.json
cat references/type-aware-rules.jsonreferences/oxc-defaults.json| Category | Meaning | Action |
|---|---|---|
| DISABLE | Target has "same" equivalent AND it's active | Safe to turn off in ESLint |
| REVIEW | Target has "inspired" equivalent AND it's active | Check behavior before disabling |
| ENABLE_TARGET | Target has equivalent but it's NOT active | Can switch by enabling in target config |
| ESLINT_ONLY | No target equivalent exists | Must keep in ESLint |
| TYPE_AWARE | Requires TypeScript type info | Expensive; check if target supports it |
for each active ESLint rule:
1. Look up in biome-eslint-mapping.json
- Resolution: exact → "eslint-plugin-" prefix → scoped (@scope/rule)
- Core ESLint rules match directly: "no-debugger"
2. No mapping → check type-aware-rules.json → TYPE_AWARE or ESLINT_ONLY
3. Mapping exists:
a. Check if Biome rule is active (match by RULE NAME only, not category)
b. Active + "same" → DISABLE
c. Active + "inspired" → REVIEW
d. Not active → ENABLE_TARGETfor each active ESLint rule:
1. Look up in oxc-eslint-mapping.json (same resolution order)
2. No mapping → TYPE_AWARE (if in type-aware list) or ESLINT_ONLY
- Oxlint supports type-aware rules via tsgolint (check "typeAware" field)
3. Mapping exists:
a. Check if active; all Oxlint mappings are "same" relationship
b. Active → DISABLE
c. Not active → ENABLE_TARGET| 分类 | 含义 | 操作 |
|---|---|---|
| DISABLE | 目标工具拥有“完全等效”规则且已激活 | 可安全关闭ESLint中的该规则 |
| REVIEW | 目标工具拥有“启发式等效”规则且已激活 | 关闭前需检查行为差异 |
| ENABLE_TARGET | 目标工具拥有等效规则但未激活 | 可通过在目标配置中启用该规则完成迁移 |
| ESLINT_ONLY | 目标工具无等效规则 | 必须保留在ESLint中 |
| TYPE_AWARE | 需要TypeScript类型信息 | 性能开销大;检查目标工具是否支持 |
对每个激活的ESLint规则:
1. 在biome-eslint-mapping.json中查找
- 匹配顺序:精确匹配 → 移除"eslint-plugin-"前缀 → 作用域规则(@scope/rule)
- ESLint核心规则直接匹配:"no-debugger"
2. 无映射 → 检查type-aware-rules.json → 标记为TYPE_AWARE或ESLINT_ONLY
3. 存在映射:
a. 检查Biome规则是否激活(仅匹配规则名称,不匹配分类)
b. 已激活且为“完全等效” → DISABLE
c. 已激活且为“启发式等效” → REVIEW
d. 未激活 → ENABLE_TARGET对每个激活的ESLint规则:
1. 在oxc-eslint-mapping.json中查找(匹配顺序同上)
2. 无映射 → 若在类型感知规则列表中则标记为TYPE_AWARE,否则为ESLINT_ONLY
- Oxlint通过tsgolint支持类型感知规则(检查"typeAware"字段)
3. 存在映射:
a. 检查是否激活;所有Oxc映射均为“完全等效”关系
b. 已激活 → DISABLE
c. 未激活 → ENABLE_TARGETreferences/docs.mdbiome migrate prettier --writeprintWidth10080endOfLine: "auto"sortImportssortTailwindcsssortPackageJsonoxfmt --migrate=prettiereslint-plugin-import@trivago/prettier-plugin-sort-importsprettier-plugin-organize-imports@ianvs/prettier-plugin-sort-imports"organizeImports": { "enabled": true }biome.json"sortImports": { ... }oxc-defaults.jsontailwindcssprettier-plugin-tailwindcssbiome-plugin-tailwindcss"sortTailwindcss": { ... }oxc-defaults.jsonoxfmt_ifTailwindreferences/docs.mdbiome migrate prettier --writeprintWidth10080endOfLine: "auto"sortImportssortTailwindcsssortPackageJsonoxfmt --migrate=prettiereslint-plugin-import@trivago/prettier-plugin-sort-importsprettier-plugin-organize-imports@ianvs/prettier-plugin-sort-importsbiome.json"organizeImports": { "enabled": true }"sortImports": { ... }oxc-defaults.jsontailwindcssprettier-plugin-tailwindcssbiome-plugin-tailwindcss"sortTailwindcss": { ... }oxc-defaults.jsonoxfmt_ifTailwindreferences/oxc-defaults.jsonundefinedreferences/oxc-defaults.jsonundefined
**Config assembly from defaults:**
- Always: `categories`, `rules`, `env`, `options` from `oxlint` section
- Always: `plugins.always` (`eslint`, `typescript`, `unicorn`, `oxc`, `import`)
- If React in deps: add `plugins.ifReact` (`react`, `react-hooks`, `jsx-a11y`)
- Oxfmt: `singleQuote`, `sortImports` from `oxfmt` section
- If Tailwind in deps: merge `oxfmt_ifTailwind` → enables `sortTailwindcss` with class sorting for `className`, `class`, and common helpers (`clsx`, `cn`, `cva`, `tw`, `twMerge`, `twJoin`)
**Vite+ projects (`$VITEPLUS=true`):** Write into `vite.config.ts` `lint` and `fmt` blocks. Do NOT create standalone config files. Example:
```typescript
import { defineConfig } from 'vite-plus';
export default defineConfig({
lint: {
categories: { correctness: 'error', suspicious: 'warn', perf: 'warn' },
plugins: ['eslint', 'typescript', 'unicorn', 'oxc', 'import', 'react', 'react-hooks', 'jsx-a11y'],
rules: {
'no-console': 'warn',
'eqeqeq': 'error',
'import/no-cycle': 'error',
},
options: { typeAware: true, typeCheck: true },
},
fmt: {
singleQuote: true,
sortImports: { ignoreCase: true, order: 'asc', newlinesBetween: true },
sortTailwindcss: { functions: ['clsx', 'cn', 'cva', 'tw'] }, // if Tailwind
},
});.oxlintrc.json.oxfmtrc.json
**基于默认配置组装:**
- 必选:`categories`, `rules`, `env`, `options`来自`oxlint`区块
- 必选:`plugins.always`(`eslint`, `typescript`, `unicorn`, `oxc`, `import`)
- 若包含React依赖:添加`plugins.ifReact`(`react`, `react-hooks`, `jsx-a11y`)
- Oxfmt: `singleQuote`, `sortImports`来自`oxfmt`区块
- 若包含Tailwind依赖:合并`oxfmt_ifTailwind` → 启用`sortTailwindcss`,支持`className`, `class`及常用工具函数(`clsx`, `cn`, `cva`, `tw`, `twMerge`, `twJoin`)的类排序
**Vite+项目(`$VITEPLUS=true`):** 写入`vite.config.ts`的`lint`和`fmt`区块。请勿创建独立配置文件。示例:
```typescript
import { defineConfig } from 'vite-plus';
export default defineConfig({
lint: {
categories: { correctness: 'error', suspicious: 'warn', perf: 'warn' },
plugins: ['eslint', 'typescript', 'unicorn', 'oxc', 'import', 'react', 'react-hooks', 'jsx-a11y'],
rules: {
'no-console': 'warn',
'eqeqeq': 'error',
'import/no-cycle': 'error',
},
options: { typeAware: true, typeCheck: true },
},
fmt: {
singleQuote: true,
sortImports: { ignoreCase: true, order: 'asc', newlinesBetween: true },
sortTailwindcss: { functions: ['clsx', 'cn', 'cva', 'tw'] }, // 若使用Tailwind
},
});.oxlintrc.json.oxfmtrc.jsonTIMING=1 pnpm exec eslint 'src/**/*.{ts,tsx}' 2>&1 | tee "$SCRATCHPAD/eslint-timing.txt"TIMING=1 pnpm exec eslint 'src/**/*.{ts,tsx}' 2>&1 | tee "$SCRATCHPAD/eslint-timing.txt"biome.jsonbiome.jsonc.oxlintrc.json.oxfmtrc.json$VITEPLUS=truelintfmtvite.config.tsbiome.jsonbiome.jsonc.oxlintrc.json.oxfmtrc.json$VITEPLUS=truevite.config.tslintfmtpnpm exec biome --version 2>/dev/null || npx biome --version 2>/dev/nullpnpm exec biome --version 2>/dev/null || npx biome --version 2>/dev/nullundefinedundefinedcat references/biome-versions.json # or oxc-versions.jsoncat references/biome-versions.json # 或 oxc-versions.jsonnursery/biome-versions.jsonpromotedFromNursery| Current (stale) | Should be | Promoted in |
|---|---|---|
| | v2.4 |
| | v2.3 |
nursery/biome-versions.jsonpromotedFromNursery| 当前(过时)规则 | 应升级为 | 升级版本 |
|---|---|---|
| | v2.4 |
| | v2.3 |
biome-versions.jsonnewRulesnoUnusedExpressionsnoImportCyclesnoFloatingPromisestrailingNewlineoxc-versions.jsonrecommendedConfigsuspiciousperfoxc-versions.jsonrecommendedConfig.rulesbiome-versions.jsonnewRulesnoUnusedExpressionsnoImportCyclesnoFloatingPromisestrailingNewlineoxc-versions.jsonrecommendedConfigsuspiciousperfoxc-versions.jsonrecommendedConfig.rulesjq -r '.dependencies.tailwindcss // .devDependencies.tailwindcss // empty' package.jsonbiome-versions.jsonnewFormatterOptionsformatter.trailingNewlineformatter.lineEnding: "auto"formatter.expandorganizeImports.enabled: truesortImportssortTailwindcssprettier-plugin-tailwindcssjsdoclint.options.typeAwarelint.options.typeCheckjq -r '.dependencies.tailwindcss // .devDependencies.tailwindcss // empty' package.jsonbiome-versions.jsonnewFormatterOptionsformatter.trailingNewlineformatter.lineEnding: "auto"formatter.expandorganizeImports.enabled: truesortImportssortTailwindcssprettier-plugin-tailwindcssjsdoclint.options.typeAwarelint.options.typeCheckundefinedundefined| Current | Updated | Version |
|---|---|---|
| | v2.3 |
| 当前规则 | 升级后规则 | 升级版本 |
|---|---|---|
| | v2.3 |
| Rule | Category | Description |
|---|---|---|
| suspicious | Detect circular imports |
| 规则 | 分类 | 描述 |
|---|---|---|
| suspicious | 检测循环导入 |
| Option | Value | Since |
|---|---|---|
| | v2.4 |
| 选项 | 推荐值 | 新增版本 |
|---|---|---|
| | v2.4 |
---
---https://biomejs.dev/linter/rules-sources/_meta.biomeVersion_meta.updatedAthttps://biomejs.dev/linter/rules-sources/_meta.biomeVersion_meta.updatedAthttps://oxc.rs/docs/guide/usage/linter/rules_meta.oxlintVersion_meta.updatedAthttps://oxc.rs/docs/guide/usage/linter/rules_meta.oxlintVersion_meta.updatedAtgh api repos/typescript-eslint/typescript-eslint/contents/packages/eslint-plugin/src/configs/flat/disable-type-checked.ts --jq '.content' | base64 -d_meta.updatedAtgh api repos/typescript-eslint/typescript-eslint/contents/packages/eslint-plugin/src/configs/flat/disable-type-checked.ts --jq '.content' | base64 -d_meta.updatedAthttps://biomejs.dev/blog/biome-vX-Yhttps://oxc.rs/blog/biome-versions.jsonoxc-versions.jsonhttps://biomejs.dev/blog/biome-vX-Yhttps://oxc.rs/blog/biome-versions.jsonoxc-versions.jsonundefinedundefined| Category | Count |
|---|---|
| DISABLE (safe to remove) | X |
| REVIEW (check before removing) | X |
| ENABLE_TARGET (can migrate) | X |
| ESLINT_ONLY (must keep) | X |
| TYPE_AWARE | X |
| 分类 | 数量 |
|---|---|
| DISABLE(可安全移除) | X |
| REVIEW(移除前需检查) | X |
| ENABLE_TARGET(可迁移) | X |
| ESLINT_ONLY(必须保留) | X |
| TYPE_AWARE(类型感知) | X |
| ESLint Rule | Target Equivalent |
|---|
| ESLint规则 | 目标工具等效规则 |
|---|
| ESLint Rule | Target Equivalent | Notes |
|---|
| ESLint规则 | 目标工具等效规则 | 注意事项 |
|---|
| ESLint Rule | Target Equivalent | Relationship |
|---|
| ESLint规则 | 目标工具等效规则 | 等效关系 |
|---|
| ESLint Rule | Type-Aware? |
|---|
| ESLint规则 | 是否为类型感知规则? |
|---|
| Prettier Option | Current Value | Target Option | Target Default | Action |
|---|
| Prettier选项 | 当前值 | 目标工具选项 | 目标工具默认值 | 操作建议 |
|---|
undefinedundefinedundefinedundefined| Rule | Time (ms) | Type-Aware? | Target Equivalent? |
|---|
| 规则 | 耗时(毫秒) | 是否为类型感知规则? | 目标工具是否有等效规则? |
|---|
undefinedundefinedreferences/docs.mdvite.config.tslintfmt.oxlintrc.json.oxfmtrc.jsontypescript-eslint/typescript-eslintreferences/docs.mdvite.config.tslintfmt.oxlintrc.json.oxfmtrc.jsontypescript-eslint/typescript-eslintreferences/biome-eslint-mapping.jsonreferences/oxc-eslint-mapping.jsonreferences/biome-versions.jsonreferences/oxc-versions.jsonreferences/oxc-defaults.jsonreferences/type-aware-rules.jsonreferences/docs.mdscripts/get-eslint-rules.sh--print-configscripts/get-biome-rules.shbiome rage --linterscripts/get-oxlint-rules.shreferences/biome-eslint-mapping.jsonreferences/oxc-eslint-mapping.jsonreferences/biome-versions.jsonreferences/oxc-versions.jsonreferences/oxc-defaults.jsonreferences/type-aware-rules.jsonreferences/docs.mdscripts/get-eslint-rules.sh--print-configscripts/get-biome-rules.shbiome rage --linterscripts/get-oxlint-rules.sh