@clipboard-health/oxlint-plugin

中文文档
1.8.7发布于 2026/11/05MITTypeScriptCommonJS近 30 天下载 3.7万

Clipboard's Oxlint plugin.

原始使用文档

@clipboard-health/oxlint-plugin

Clipboard's custom Oxlint rules. Consumers should normally use the presets exported by @clipboard-health/oxlint-config.

The package is independent of ESLint and @typescript-eslint. Its standard create(context) rules are also re-exported by @clipboard-health/eslint-plugin for repositories that still use ESLint.

Rules

  • enforce-contract-in-controllers
  • enforce-ts-rest-in-controllers: deprecated alias of enforce-contract-in-controllers, removed in the next major version
  • no-ambiguous-positional-parameters
  • no-empty-boolean-call
  • no-cross-contract-imports
  • no-parallel-mongo-session-ops
  • no-tests-in-contract-packages
  • require-contract-fixture-construction
  • require-contract-response-parse
  • require-http-module-factory
  • require-run-validators-with-upsert
  • require-to-declared-error
  • require-zod-import-in-contracts

Configuration

Use the customRules preset from @clipboard-health/oxlint-config to register the plugin and apply the shared controller, module, contract, and cross-contract-import scopes. The contractFixtures preset enables fixture-construction checks in tests.

no-empty-boolean-call, require-contract-response-parse, and require-run-validators-with-upsert are opt-in because their safe adoption scope is repository-specific.

customRules enables no-tests-in-contract-packages from @clipboard-health/oxlint-config 3.0.0. It reports only test files inside packages/contract-* directories, excluding packages/contract-core.

no-parallel-mongo-session-ops is also opt-in. Out of the box it covers Promise.all, Promise.allSettled, Promise.race, and Promise.any. Repositories with their own bounded-concurrency helpers must name them, or those call sites go unchecked:

"@clipboard-health/no-parallel-mongo-session-ops": [
  "warn",
  { additionalPrimitives: ["batchPromiseAllWithLimit", "batchPromiseAllSettledWithLimit"] },
],

Exclude tests: app-level session objects such as session.sessionUserId share the name but are unrelated to MongoDB sessions.

require-to-declared-error is opt-in while services adopt oRPC. In a handler passed to oRPC's implement(...).handler(), every throw in a branch that handles a failed ServiceResult must throw toDeclaredError({ errors, error }) from @clipboard-health/api-nestjs, or one of the handler's errors constructors, so the response keeps the status the contract declares. The branch may still return. The rule is syntactic: its file comment lists the conditions it recognizes and the forms it skips. Enable it on controllers:

{
  files: ["**/*.controller.ts"],
  rules: { "@clipboard-health/require-to-declared-error": "error" },
},

版本与发布记录

@clipboard-health/oxlint-plugin 共发布 46 个版本,首次发布于 2026/08/15;过去 12 个月发布了 46 个版本。

版本发布日期距今
1.8.7latest2026/11/054 天前
1.8.62026/11/054 天前
1.8.52026/11/055 天前
1.8.42026/11/045 天前
1.8.32026/11/045 天前
1.8.22026/11/036 天前

关于 @clipboard-health/oxlint-plugin 的常见问题

@clipboard-health/oxlint-plugin 是什么?

Clipboard's Oxlint plugin.

如何安装 @clipboard-health/oxlint-plugin?

在项目目录运行 npm install @clipboard-health/oxlint-plugin,或使用 pnpm add / yarn add / bun add。

@clipboard-health/oxlint-plugin 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@clipboard-health/oxlint-plugin 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@clipboard-health/oxlint-plugin 可以商用吗?

@clipboard-health/oxlint-plugin 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@clipboard-health/oxlint-plugin 的下载量有多少?

根据 npm 官方下载统计,@clipboard-health/oxlint-plugin 在 2026/10/10 – 2026/11/08 这 30 天内被下载 37,423 次,日均约 1,247 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@clipboard-health/oxlint-plugin 还在维护吗?

最新版本 1.8.7 发布于 2026/11/05(4 天前);至今共发布 46 个版本,其中过去 12 个月发布了 46 个;首次发布于 2026/08/15。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。