Skip to content

INFO

这篇博客文章最初发表于VoidZero网站(https://voidzero.dev/posts/announcing-oxlint-1-stable)。

🌐 This blog post was originally published on the VoidZero website.


TL;DR:首个稳定版本的 Oxlint 已经发布!相比 ESLint 性能提升了约 50~100 倍,支持超过 500 条 ESLint 规则,并且已在 Shopify、Airbnb 和梅赛德斯-奔驰等 知名公司 中使用,你应该试一试。立即开始

🌐 TL;DR: The first stable version Oxlint has been released! With a 50~100x performance improvement over ESLint, support for over 500 ESLint rules, and usage in major companies like Shopify, Airbnb, and Mercedes-Benz, you should give it a try. Get started now.


Oxlint 是一个基于 Rust 的 JavaScript 和 TypeScript 静态检查工具,旨在快速且易于上手。自 2023 年 12 月首次发布以来,Oxlint 已经历了重大改进,现在发布了首个稳定版本 1.0。

除了稳定版本的发布,我们还想宣布 Oxlint 拥有一位专职维护者 Cameron,以及一个不断壮大的核心团队,致力于维护和改进该静态检查工具。

🌐 Oxlint is a Rust-powered linter for JavaScript and TypeScript, designed to be fast and easy to adopt. Since its initial announcement in December 2023, Oxlint has undergone significant improvements and is now releasing its first stable version, 1.0. In addition to the stable release, we also want to announce that Oxlint has a dedicated full-time maintainer, Cameron, and a growing core team working on maintaining and improving the linter.

现实影响

🌐 Real-World Impact

我们对 Oxlint 的表现及其对真实大规模代码库的影响感到非常自豪,这也带来了持续集成成本的降低。

🌐 We are extremely proud of the performance of Oxlint and its impact on real, large-scale codebases, which has led to reduced CI costs.

我们感谢我们的 5,200 名早期采用者 以及以下公司和项目:

🌐 We are thankful for our 5,200 early adopters and for companies and projects such as:

  • Shopify,前端平台团队在 Shopify 管理控制台中使用 Oxlint。
  • Airbnb 使用多文件分析 oxc/no-barrel-fileimport/no-cycle 来检查他们的 126,000+ 个文件,这在持续集成(CI)中可以在 7 秒内完成。而 ESLint 对这些规则的实现会超时。
  • 梅赛德斯-奔驰 在将 ESLint 切换到 Oxlint 时,观察到 lint 时间减少了 71%,部分项目的速度提升甚至高达 97%。
  • 大型开源项目,从像 Bun 这样的运行时到像 Preact 这样的框架。

在我们找到的最大仓库上,Oxlint 报告了:

🌐 On the largest repository we found, Oxlint reported:

Finished in 22.5s on 264925 files with 101 rules using 10 threads.

根据发布在 XBluesky 的真实案例,Oxlint 的运行速度约为每秒 10,000 个文件,具体取决于使用的线程总数。

🌐 Based on real-world cases posted on X and Bluesky, Oxlint runs at approximately 10,000 files per second, depending on the total number of threads used.

快速开始

🌐 Quick Start

Oxlint 非常适合希望在不花费数小时配置工具的情况下开始对代码进行 lint 的开发者。无需任何设置,你就可以立即开始发现问题:

🌐 Oxlint is perfect for developers who want to start linting their code without spending hours configuring tools. With zero setup required, you can start catching issues immediately:

运行即可,无需配置。

sh
$ npx oxlint@latest
sh
$ pnpm dlx oxlint@latest
sh
$ yarn dlx oxlint@latest
sh
$ bunx oxlint@latest
sh
$ deno run npm:oxlint@latest

虽然无需设置或配置,但 Oxlint 可以通过 .oxlintrc.json 文件进行配置,这对大型项目或需要更多自定义的项目非常有用。
这种配置格式基于 ESLint v8 的扁平配置,使迁移变得简单且熟悉。
每个源文件都使用最近的适用配置进行检查,你可以使用覆盖功能来针对特定的 glob 模式。
你还可以扩展共享配置,以保持团队的一致性。

🌐 While no setup or configuration is needed, Oxlint is configurable via an .oxlintrc.json file, which is useful for larger projects or projects that require more customization. This configuration format is based on ESLint v8’s flat config, making migration easy and familiar. Each source file is linted with the nearest applicable configuration, and you can use overrides to target specific glob patterns. You can also extend shared configs to keep teams consistent.

对于已经使用 ESLint 的项目,可以使用 oxlint-migrate 将现有的 ESLint 平面配置文件迁移到 Oxlint。 此外,eslint-plugin-oxlint 可以在同时使用两种 linter 时禁用重叠的 ESLint 规则。 建议运行 oxlint && eslint 以享受 Oxlint 更快的反馈周期。

🌐 For projects already using ESLint, oxlint-migrate can be used to migrate an existing ESLint flat-config file to Oxlint. Additionally, eslint-plugin-oxlint can disable overlapping ESLint rules while both linters are used together. It is recommended to run oxlint && eslint to benefit from Oxlint's faster feedback cycle.

有关如何使用 Oxlint 以及将其与你的项目或编辑器集成的更详细说明,请查看安装指南

🌐 For more detailed instructions on how to use Oxlint and integrate it with your project or editor, check out the installation guide.

版本控制

🌐 Versioning

与提供运行时代码的库不同,linter 仅会更改它返回的诊断结果。Oxlint 遵循语义化版本控制:

🌐 Unlike libraries that ship runtime code, a linter only changes the diagnostics it returns. Oxlint adheres to semantic versioning:

  • 补丁版本:仅修复漏洞。
  • 小版本更新:扩展规则覆盖范围和诊断功能,无需更改配置。
  • 主要版本发布:CLI 或配置更改,可能需要迁移。请注意,如果新添加的规则揭示了之前隐藏的问题,小版本发布仍然可能会影响你的 CI。更多信息请参阅我们的 版本指南

亮点

🌐 Highlights

全面规则覆盖

🌐 Comprehensive Rule Coverage

Oxlint 包含来自各种来源的 500 多条规则:

🌐 Oxlint includes over 500 rules from various sources:

  • 完整的 ESLint 规则集,包括来自 typescript-eslint 的 TypeScript 特定规则(不包括类型检查规则)。
  • 来自 eslint-plugin-unicorneslint-plugin-jsdoceslint-plugin-reacteslint-plugin-react-hookseslint-plugin-jesteslint-plugin-import 的流行插件规则
  • 独特的 Oxlint 规则,如 错误的比较顺序常量比较仅在递归中使用

灵活配置

🌐 Flexible Configuration

通过 .oxlintrc.json 文件配置 Oxlint,并支持以下功能:

🌐 Configure Oxlint through .oxlintrc.json files with support for:

  • 适用于特定目录的嵌套配置
  • 覆盖用于针对特定文件类型或位置的模式
  • 共享配置扩展以保持团队一致性

编辑器集成

🌐 Editor Integration

一流的编辑器支持,附带以下扩展:

🌐 First-class editor support with extensions for:

有用的诊断

🌐 Helpful Diagnostics

Oxlint 的设计初衷是提供清晰、可操作的错误信息——不仅描述问题,还能可视化展示问题并建议解决方法。

🌐 Oxlint is built to deliver clear, actionable error messages - not just describing the issue, but visualizing it and suggesting how to fix it.

CLI 演示在终端中运行 Oxlint 并进行详细错误报告

基准

🌐 Benchmark

我们的基准测试显示,在相同的设置下,Oxlint 比 ESLint 快大约 50~100 倍。

🌐 Our benchmark reveals that Oxlint is around 50~100 times faster than ESLint with the same setup.

工具时间
oxlint(多线程)615.3 毫秒
oxlint(单线程)1.840 秒
eslint33.481 秒

路线图

🌐 Roadmap

Oxlint 1.0 只是个开始!虽然它很稳定,但我们仍然计划为未来版本带来重要功能和改进:

🌐 Oxlint 1.0 is just the beginning! While it is stable, we still have important features and improvements planned for future releases:

自定义规则 – JavaScript 插件支持即将推出,团队将能够编写与 Oxlint 架构无缝集成的自定义规则。

性能优化——持续提升解析和分析速度。

细粒度(每个全局)配置 - ESLint v9 配置

致谢

🌐 Acknowledgements

Oxlint 1.0 代表了由 超过200名贡献者 共同努力打造的项目成果。我们感谢每一条错误报告、功能请求和代码贡献。

🌐 Oxlint 1.0 represents the collective effort of over 200 contributors who have shaped this project. We're grateful for every bug report, feature request, and code contribution.

特别致谢:

🌐 Special recognition goes to:

  • @branchseer 实现了多文件分析运行时。
  • @camc314@mysteryven@shulaoda 感谢他们实现了许多复杂的 lint 规则,进行测试,并不断改进一切。
  • @camchenry 实现了嵌套配置支持。
  • @DonIsaac 感谢他改进配置、文档和网站,并代表 Oxc 出席 SquiggleConf 2024
  • 感谢 @leaysgur 提供正则表达式解析器和 JSDoc 插件。
  • @Sysix 感谢维护 eslint-plugin-oxlint,并对语言服务器和 VSCode 插件做出的重要贡献。
  • 感谢@u9g@rzvxa实现控制流图分析。

加入社区

🌐 Join the Community

我们非常希望听取你对 Oxlint 的反馈,并期待看到它如何帮助改进你的开发工作流程。与我们联系:

🌐 We'd love to hear your feedback on Oxlint and are excited to see how it helps improve your development workflow. Connect with us:

你的反馈推动了Oxlint的发展。

🌐 Your feedback drives Oxlint's evolution.

试一试

🌐 Give It a Try

要开始使用,请遵循安装指南,或了解更多关于Oxc项目的信息。

🌐 To get started, follow the installation guide, or learn more about the Oxc project.