@bensandee/eslint-plugin

中文文档
0.18.0发布于 2026/10/24MITES Module零依赖近 30 天下载 2849
中文使用文档
文档目录6 节
  1. 安装
  2. 使用量
  3. 规则
  4. 通则
  5. 霍诺规则
  6. 出口

@bensandee/eslint-plugin (英语)

Oxlint 插件,带有自定义类型Script lint规则,用于类型安全,错误处理和代码模式.

安装

pnpm add -D @bensandee/eslint-plugin oxlint

大多数消费者应当使用 @bensandee/config/oxlint/recommended 相反,它将这个插件捆绑在一个被整理的预设的牛林内置规则上.

使用量

// oxlint.config.ts
import recommended from "@bensandee/eslint-plugin/recommended";
import { defineConfig } from "oxlint";

export default defineConfig({ extends: [recommended] });

规则

所有规则都使用 bensandee/ 前缀.

通则

规则说明严重性
bensandee/no-type-assertion否定 as 类型断言 -- -- 取而代之的是Zod验证; as unknown as 即使在测试中错误
bensandee/no-inline-type-predicate取消用户定义的带有内线的类型上游 { ... } 目标错误
bensandee/no-mixed-exports拒绝混合默认和命名导出错误
bensandee/no-empty-catch无例外地取消空捕获块错误
bensandee/no-zod-parse否定 .parse() -- 使用 .safeParse() 换成错误
bensandee/no-plain-error否定 throw new Error(...) -- 使用输入错误 @bensandee/common错误
bensandee/no-zod-any否定 z.any() -- 使用 z.unknown() 换成错误
bensandee/no-unsafe-json-parse否定 JSON.parse() 没有Zod验证错误
bensandee/no-unsafe-response-json否定 .json() 在没有Zod验证的情况下获取回复错误
bensandee/no-unsafe-exec取消带有内插命令字符串的执行调用 -- -- 使用参数阵列形式错误
bensandee/no-anonymous-type取消带有 2+ 成员的匿名对象类型警告( e)
bensandee/no-inline-query-keys取消对内数组查询键 -- -- 使用中央查询键厂错误
bensandee/no-deep-relative-import深度减少相对进口 -- -- 使用次路径进口(#/(中文(简体) )警告( e)
bensandee/no-plan-citation在评论中否定计划/实例引用 -- -- 生命周期管理的文件/路径和决定/任务ID错误
bensandee/no-pr-citation拒绝拉动请求并在注释中发布引用错误
bensandee/max-comment-lines取消毗连的单行注释块超过行限制警告( e)
bensandee/compat-expiry警告当一个 @compat 向后兼容标记已经通过日期或版本, 或者没有解析警告( e)
bensandee/no-optional-nullable取消冗余的无效性( N)? 与 | null(中文(简体) )警告( e)

霍诺规则

这些规则通过导入检测自出门 -- -- 它们只在从导入的文件中开火 hono 或者说 hono/*。 。 。 .

规则说明严重性
bensandee/hono-no-direct-fetch拒绝直接 fetch() 在Hono项目中 -- -- 使用输入的客户端错误
bensandee/hono-no-untyped-context脱光 Context 类型 -- -- 需要 Context<Env>错误

出口

入境点说明
@bensandee/eslint-plugin带有所有规则的插件对象( 默认导出)
@bensandee/eslint-plugin/recommended建议启用自定义规则的 oxlint 配置
@bensandee/eslint-plugin/rules所有规则执行情况的记录
@bensandee/eslint-plugin/test-harness针对牛林二进制运行规则的集成测试工具

版本与发布记录

@bensandee/eslint-plugin 共发布 25 个版本,首次发布于 2026/03/03;过去 12 个月发布了 25 个版本。

版本发布日期距今
0.18.0latest2026/10/2415 天前
0.17.02026/10/0830 天前
0.16.02026/10/061 个月前
0.15.22026/09/231 个月前
0.15.12026/09/032 个月前
0.15.02026/09/032 个月前

关于 @bensandee/eslint-plugin 的常见问题

如何安装 @bensandee/eslint-plugin?

在项目目录运行 npm install @bensandee/eslint-plugin,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:oxlint(>=1.88.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@bensandee/eslint-plugin 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/bensandee__eslint-plugin 是否存在。

@bensandee/eslint-plugin 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@bensandee/eslint-plugin 可以商用吗?

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

@bensandee/eslint-plugin 的下载量有多少?

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

@bensandee/eslint-plugin 还在维护吗?

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