“格式化太慢?Lint 卡到爆?不,我们全都要。” —— 尤雨溪

一条推文,前端圈炸锅

10 月 19 日下午,Vue.js 作者尤雨溪Twitter 甩出一张截图:

转存失败,建议直接上传图片文件

  • oxfmtBiome2–3 倍
  • Prettier45 倍
  • Biome 更贴合 Prettier 规范
  • 已跑通 ViteVueAntDesignSupabase亿级代码库
  • “即将可用,直接平替 Prettier!”

配图最后一句话,才是核弹:

ESLint 也一起被“斩”?

等等,ESLint 呢?

转存失败,建议直接上传图片文件

别急,Oxlint 早已埋伏多时:

工具职责替代目标性能倍数
oxfmt代码格式化Prettier45×
oxlint代码检查ESLint50–100×

Oxlint 规则已覆盖 200+ 条 ESLint 核心与社区推荐规则,并支持 --fix 自动修复。

ViteRollupVue-core 的 CI 里,ESLint 全程没启动,Oxlint 0 秒跑完。

为什么要“弃用”?

  1. 速度 = 生产力
    本地 save 秒级反馈,CI 从 3 min → 5 s,老板都忍不住点赞。

  2. 兼容 ≈ 零迁移
    oxfmtPrettier 快照测试 99.7% 一致
    oxlint 提供 eslint-compat 插件,老配置直接导入。

  3. 可扩展 > 老生态
    基于 RustWASM 插件,冷启动 <10 ms,不再被 Node 单线程卡死。

  4. 改进,而不是迁就
    对于带注释的 TS 联合类型,Prettier 会“对不齐”,oxfmt 主动修正
    尤雨溪直言:“不是固执,是 Prettier 真的错了。

迁移指南

1. 一键卸载老伙伴

npm  uninstall prettier eslint eslint-config-xxx eslint-plugin-xxx

2. 安装 OXC 全家桶

npm  i  -D  oxc-cli
# 或
pnpm  add  -D  oxc-cli

3. 配置 oxc.config.js

export default {
  formatter: { enable: true, semi: false, tabWidth: 2 },
  linter: {
    enable: true,
    rules: { import: { noCycle: 'error' } }
  }
}

4. 脚本替换

{
  "scripts": {
    "fmt": "oxc fmt",
    "lint": "oxc lint",
    "lint:fix": "oxc lint --fix"
  }
}

5. GitHub Actions 示例

- name: Lint & Format
  run: |
    npx oxc fmt --check
    npx oxc lint

写在最后

十年前,GruntGulpWebpack
五年前,RollupVite
今天,ESLint + Prettier → OXC

尤雨溪又一次把“不可能”写成 PR 标题:
“feat: retire eslint & prettier”

准备好迎接 0 秒 lint、0 秒 format 的新时代了吗?

OXC 官网/仓库https://github.com/oxc-project/oxc

本站提供的所有下载资源均来自互联网,仅提供学习交流使用,版权归原作者所有。如需商业使用,请联系原作者获得授权。 如您发现有涉嫌侵权的内容,请联系我们 邮箱:[email protected]