开源日报每天推荐一个 GitHub 优质开源项目和一篇精选英文科技或编程文章原文,坚持阅读《开源日报》,保持每日学习的好习惯。

2023年12月20日,开源日报第1050期:
今日推荐开源项目:《How-To-Ask-Questions-The-Smart-Way》
今日推荐英文原文:《Vue 2 is Approaching End Of Life》


开源项目

今日推荐开源项目:《How-To-Ask-Questions-The-Smart-Way》传送门:项目链接

推荐理由:如何高效提问是一门艺术,开发中肯定会遇到一些目前阶段解决不来了的问题,通过 google stackoverflow github issue等途径找不到解决方案时,如何高效向 leader或更高级程序员提问请教,看完这个 repo相信一定会有收获


英文原文

今日推荐英文原文:Oxlint General Availability

推荐理由:Rust 继续锈化前端工具链生态,Oxlint 正式发布,比 ESLint 快 50-100 倍,像 Rust 编译器一样提供了增强的诊断功能,简化 Lint 信息的理解,节省阅读规则文档的时间,这篇文章将简述 oxlint 和 eslint 到底有什么区别


Oxlint General Availability

We're thrilled to announce that oxlint is now generally available! This milestone signifies our team's ability to promptly address and triage issues.

Oxlint is a JavaScript linter designed to catch erroneous or useless code without requiring any configurations by default.

How to Use

At this stage, oxlint is not intended to fully replace ESLint; it serves as an enhancement when ESLint's slowness becomes a bottleneck in your workflow.

For faster feedback loops, we recommend running oxlint before ESLint in your lint-staged or CI setup, considering it only takes a few seconds to run on large codebases.

To test oxlint in your JavaScript / TypeScript codebase, simply execute the following command at the root directory of your repository:

npmpnpmyarnbundeno

sh

$ npx oxlint@latest

Alternatively, refer to the installation guide for detailed instructions.

Design

50-100 Times Faster than ESLint

In real-world scenarios, Shopify reported that their 75 CI minutes ESLint run is now only 10 seconds.

From Jason Miller, Shopify DX and creator of Preact:

oxlint has been a massive win for us at Shopify. Our previous linting setup took 75 minutes to run, so we were fanning it out across 40+ workers in CI.

By comparison, oxlint takes around 10 seconds to lint the same codebase on a single worker, and the output is easier to interpret.

We even caught a few bugs that were hidden or skipped by our old setup when we migrated!

The majority of the performance gains stem from Oxlint being purposefully designed for performance, utilizing Rust and parallel processing as key factors.

Lint for Correctness

Oxlint defaults to identifying erroneous, redundant, or confusing code — prioritizing correctness over unnecessary nitpicking rules (categorized as perfsuspiciouspedantic, or style), which are disabled by default.

Ease of Use

Setting up new JavaScript / TypeScript codebases is becoming increasingly complex. There's a high likelihood of encountering compatibility issues among your tools, potentially resulting in hours of wasted time.

That's why we designed oxlint to be zero-config out of the box; even Node.js is not a requirement. Most adjustments can be made through the command-line, and reading from ESLint configuration file is currently work in progress.

Enhanced Diagnostics

Understanding linter messages can be challenging. Oxlint aims to simplify this by pinpointing root causes and providing helpful messages — eliminating the need for lengthy rule documentation reading, saving valuable time.

Running oxlint -D perf in the vscode repository:

Consolidated Rules

Oxlint does not provide a plugin system yet, but we are actively consolidating rules from popular plugins like TypeScript, React, Jest, Unicorn, JSX-a11y and Import.

We recognize the importance of plugins in the JavaScript ecosystem and are also investigating a DSL-based plugin system.

However, you might appreciate a standalone linter — no need to manage a list of plugin dependencies, navigate through compatibility issues, or resort to forked plugins due to version constraints.


Happy linting and have a joyful holiday season!

To get started, follow the installation guide, learn more about the oxc project, or discuss on Hacker News.


下载开源日报APP:https://openingsource.org/2579/
加入我们:https://openingsource.org/about/join/
关注我们:https://openingsource.org/about/love/