開源日報每天推薦一個 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/