我们很高兴地宣布 oxlint --import-plugin 的 alpha 版本发布,这是 eslint-plugin-import 的一个移植版本。
🌐 We are excited to announce an alpha release for oxlint --import-plugin, a port of eslint-plugin-import.
此端口旨在解决与 eslint-plugin-import 相关的所有已知问题:
🌐 This port aims to resolve all known issues associated with eslint-plugin-import:
- 性能 - 启用某些规则时执行时间超过一分钟
- 依赖大小 - 188 个依赖,总计 30M
- 向后兼容性——必须支持 Node.js v4.0.0
- 依赖兼容性——需要将其替换为
eslint-plugin-import-x - 升级到 ESLint v9
这个版本有什么内容?
🌐 What's in the release?
如果你的项目使用 ESM(ECMAScript 模块),预计此 alpha 版本可以正常工作。
🌐 This alpha release is expected to work if your project is in ESM (ECMAScript Modules).
如果需要通过 tsconfig.compilerOptions.paths 使用路径别名(例如 @/foo),可以使用 --tsconfig 选项:
🌐 If path aliases (e.g. @/foo) are required through tsconfig.compilerOptions.paths, the --tsconfig option can be used:
npx oxlint@latest --tsconfig ./tsconfig.json --import-plugin通过 npx oxlint@latest --import-plugin 默认启用的规则有:
🌐 The rules that are enabled by default via npx oxlint@latest --import-plugin are:
可以通过 npx oxlint@latest --import-plugin -D rule-name 选择性启用的规则有:
🌐 Rules that can be enabled selectively via npx oxlint@latest --import-plugin -D rule-name are:
这些规则也有改进;例如,no-cycle 规则的诊断功能已经得到了改进:
🌐 There are also improvements to these rules; for example, the diagnostics for the no-cycle rule have been improved:
⚠ eslint-plugin-import(no-cycle): Dependency cycle detected
╭─[apps/web/playwright/lib/fixtures.ts:13:42]
12 │ import { createPaymentsFixture } from "../fixtures/payments";
13 │ import { createBookingPageFixture } from "../fixtures/regularBookings";
· ─────────────────────────────
14 │ import { createRoutingFormsFixture } from "../fixtures/routingForms";
╰────
help: These paths form a cycle:
-> ../fixtures/regularBookings - apps/web/playwright/fixtures/regularBookings.ts
-> ./users - apps/web/playwright/fixtures/users.ts
-> ../lib/testUtils - apps/web/playwright/lib/testUtils.ts
-> ./fixtures - apps/web/playwright/lib/fixtures.ts这不是一长串功能清单,但由于当前生态系统状态的复杂性,实现这些规则并确保其正确运行需要付出大量努力。
🌐 This isn't a long list of features, but due to the complexity of the current state of the ecosystem, it requires a lot of effort to implement these rules and ensure they work correctly.
在过去的六个月里,我们利用业余时间工作,成功完成了 --import-plugin 正常运行的所有前提条件:
🌐 Over the past six months, we have worked in our spare time and successfully completed all the prerequisites for the --import-plugin to work:
- 用于模块解析的 解析器
- 一个小型的运行时,用于最大化并行处理依赖的文件
- 一个用于存储进出口信息的
ModuleRecord数据结构,以及其对应的 构建器
我能帮什么吗?
🌐 How can I help?
如果你是项目维护者(也称配置工程师),而且缺乏时间或精力来保持 ESLint 及其所有插件的更新,你可以效仿 @brooooooklyn 的做法,在他所有的项目中用 oxlint 替换 ESLint。
🌐 If you are a project maintainer (a.k.a. configuration engineer) and lack the time or energy to keep ESLint and all its plugins updated, you may follow @brooooooklyn's lead and replace ESLint with oxlint in all his projects.
如果你是开源爱好者并且愿意提供帮助,欢迎在 discord 与我们交流,查看 linter 产品计划和进展问题,或者通过 提出被推迟的新规则 来帮助我们。
🌐 If you are an open-source enthusiast and are willing to help out, come talk to us on discord, check out the linter product plan and progress issue, or help by proposing new rules that were deferred.
如果你是一名工程经理,或者愿意将你的项目迁移到 oxlint(包含 330 条规则且还在不断增加)以降低你的基础设施成本,你可以考虑赞助,以便我们优先处理你的项目。
🌐 If you are an engineering manager, or are willing to migrate your project to oxlint (with 330 rules and growing) to keep your infrastructure costs down, you may consider sponsoring so we can prioritize your project.
请记住,oxlint 目前是社区驱动的,我相信只要有足够的资源,我们可以在接下来的几个月内让 --import-plugin 普遍可用。
🌐 Please remember oxlint is currently community driven, I believe that with enough resources, we can make --import-plugin generally available in the next few months.
要开始使用 oxlint,请按照安装指南操作,或了解更多关于oxc 项目的信息。
🌐 To start using oxlint, follow the installation guide or learn more about the oxc project.
