@bensandee/eslint-plugin

中文文档
0.18.0发布于 2026/10/24MITES Module零依赖近 30 天下载 2849
原始使用文档
文档目录6 节
  1. Installation
  2. Usage
  3. Rules
  4. General rules
  5. Hono rules
  6. Exports

@bensandee/eslint-plugin

Oxlint plugin with custom TypeScript lint rules for type safety, error handling, and code patterns.

Installation

pnpm add -D @bensandee/eslint-plugin oxlint

Most consumers should use @bensandee/config/oxlint/recommended instead, which bundles this plugin with a curated preset of oxlint built-in rules.

Usage

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

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

Rules

All rules use the bensandee/ prefix.

General rules

RuleDescriptionSeverity
bensandee/no-type-assertionDisallow as type assertions -- use Zod validation instead; as unknown as even in testserror
bensandee/no-inline-type-predicateDisallow user-defined type predicates with inline { ... } targetserror
bensandee/no-mixed-exportsDisallow mixing default and named exportserror
bensandee/no-empty-catchDisallow empty catch blocks without an exception parametererror
bensandee/no-zod-parseDisallow .parse() -- use .safeParse() insteaderror
bensandee/no-plain-errorDisallow throw new Error(...) -- use typed errors from @bensandee/commonerror
bensandee/no-zod-anyDisallow z.any() -- use z.unknown() insteaderror
bensandee/no-unsafe-json-parseDisallow JSON.parse() without Zod validationerror
bensandee/no-unsafe-response-jsonDisallow .json() on fetch responses without Zod validationerror
bensandee/no-unsafe-execDisallow exec calls with interpolated command strings -- use arg-array formerror
bensandee/no-anonymous-typeDisallow anonymous object types with 2+ memberswarn
bensandee/no-inline-query-keysDisallow inline array query keys -- use a centralized query key factoryerror
bensandee/no-deep-relative-importDisallow deeply nested relative imports -- use subpath imports (#/)warn
bensandee/no-plan-citationDisallow plan/spec citations in comments -- lifecycle-managed docs/ paths and decision/task IDserror
bensandee/no-pr-citationDisallow pull request and issue citations in commentserror
bensandee/max-comment-linesDisallow contiguous single-line comment blocks exceeding a line limitwarn
bensandee/compat-expiryWarn when a @compat backwards-compatibility marker has passed its date or version, or does not parsewarn
bensandee/no-optional-nullableDisallow redundant nullability (? with | null)warn

Hono rules

These rules self-gate via import detection -- they only fire in files that import from hono or hono/*.

RuleDescriptionSeverity
bensandee/hono-no-direct-fetchDisallow direct fetch() in Hono projects -- use the typed clienterror
bensandee/hono-no-untyped-contextDisallow bare Context type -- require Context<Env>error

Exports

Entry pointDescription
@bensandee/eslint-pluginPlugin object with all rules (default export)
@bensandee/eslint-plugin/recommendedRecommended oxlint config enabling all custom rules
@bensandee/eslint-plugin/rulesRecord of all rule implementations
@bensandee/eslint-plugin/test-harnessIntegration test harness for running rules against the oxlint binary

版本与发布记录

@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 和提交记录判断。