@alxwlw/oxlint-config

中文文档
1.9.2发布于 2026/11/04MITES Module构建来源已验证近 30 天下载 2781

The alxwlw oxlint canon for oxlint 1.x + oxlint-tsgolint (type-aware): base/node/nest/react/next presets, TypeScript-7-compatible (tsgolint embeds typescript-go).

原始使用文档
文档目录4 节
  1. Presets
  2. Usage
  3. Sharp edges (all empirically verified)
  4. The stack JS plugin

@alxwlw/oxlint-config

The alxwlw lint canon for oxlint 1.x + oxlint-tsgolint, built for repos on TypeScript 7 (typescript-eslint has no TS7-compatible compiler API until TS 7.1 and upstream will not support 7.0; tsgolint embeds typescript-go, so the repo's typescript version is irrelevant to linting).

Presets

PresetExtendsAdds
base—correctness category, full type-aware set (tsgolint), simple-import-sort
nodebasestack/naming-convention (canon selector set)
nestnodestack/require-nest-di-decorator; typescript/require-await off (Nest guard contract); typescript/consistent-type-imports off (DI-safe imports)
reactbasereact-hooks classic pair + eslint-plugin-react recommended + jsx-a11y recommended ports
nextreactoxlint nextjs plugin
library— (overlay)stack/tsdoc-syntax for TS/TSX; reads the nearest tsdoc.json

base deliberately carries a curated strict subset beyond typescript-eslint's recommendedTypeChecked defaults, proven at error level in production (no-unnecessary-condition, no-deprecated, restrict-template-expressions, …). Prettier remains a separate gate (oxlint does not format); dependency-cruiser remains the architecture/cycle engine (import/no-cycle stays off).

Usage

// .oxlintrc.json (repo root)
{
    "extends": ["./node_modules/@alxwlw/oxlint-config/nest.jsonc"],
    "ignorePatterns": ["**/dist/**", "**/*.generated.*"],
}
oxlint --type-aware --report-unused-disable-directives --config .oxlintrc.json .

Packages that publish an API layer the library overlay after their preset (not usable on its own — the stack plugin comes from the preset):

// .oxlintrc.json of the publishing package
{
    "extends": [
        "./node_modules/@alxwlw/oxlint-config/node.jsonc",
        "./node_modules/@alxwlw/oxlint-config/library.jsonc",
    ],
}

Declare your own TSDoc tags in tsdoc.json instead of switching the rule off; the file needs the standard "$schema": "https://developer.microsoft.com/json-schemas/tsdoc/v0/tsdoc.schema.json" (without it tsdoc-config reports Unsupported JSON "$schema" value). The overlay goes after the preset on purpose: it does not extend base, so it cannot switch back on what nest or react turned off.

For browser code in a mixed repo, drop a nested .oxlintrc.json extending react.jsonc into the frontend root — oxlint auto-discovers nested configs per subtree (a nested config REPLACES the root one for that subtree, which is why react.jsonc extends base.jsonc itself).

Sharp edges (all empirically verified)

  • --type-aware is load-bearing. Without the flag every typescript/* type-aware rule is SILENTLY skipped — no error, no warning. Keep the flag in the repo's lint task; oxlint-tsgolint must be installed (optional peer).
  • Build .d.ts before type-aware lint in project-reference monorepos (tsc --build first; the canon moon-tasks lint has no typecheck dependency, so this applies to project-reference repos): unresolved imports produce error-typed values that fire the no-unsafe-* rules as phantoms.
  • plugins merge across extends — a consumer that adds a plugin lists only the new one. The presets restate their full list anyway, so each reads as one file (see react.jsonc); oxlint-config.test.ts keeps them complete.
  • Never run --fix-suggestions in automation: tsgolint's require-await "suggestion" rewrites public signatures (Promise<T> → T). Plain --fix is safe; outside nest (which turns consistent-type-imports off), the consistent-type-imports × import/no-duplicates fixers can collide on one import pair — a second --fix pass converges.
  • Out-of-program files (tests, tool config files, plain JS) are linted under an inferred strict program by tsgolint; base.jsonc mirrors tseslint's disableTypeChecked for the universal globs — extend that override in the consuming repo for repo-specific out-of-program trees (scripts/, e2e/, bundler-frontend subdirs). Tool config files are an explicit list (vite/vitest/playwright/…); production src/**/*.config.ts stays type-checked.
  • import type conversions can break NestJS DI: nest.jsonc turns off typescript/consistent-type-imports — oxlint does not model emitDecoratorMetadata, and the rule's autofix used to convert the import of a class injected by ctor-param type into import type (Nest DI then fails at startup while tsc and lint stay green). A Nest consumer no longer needs its own override; an import type of an injected class in Nest code is an error only a startup catches. An explicit @Inject(Class) (this canon's convention) remains an optional way to make the dependency explicit.

The stack JS plugin

./plugin exports the in-house rules (ESLint rule API, run by oxlint's jsPlugins host — requires running oxlint via the npm CLI, which every moon task does):

  • stack/require-nest-di-decorator — ported from a private ESLint-rule original; see NOTICE for provenance. The two are no longer kept in lockstep and will drift.
  • stack/naming-convention — port of the canon naming selector set; option { "leadingUnderscore": "none" | "allow" | "allowSingleOrDouble" } for repos with a _-prefix private-by-convention marker.
  • stack/tsdoc-syntax — enabled by the library overlay; reads the nearest tsdoc.json (like eslint-plugin-tsdoc). @microsoft/tsdoc-backed TSDoc validation (eslint-plugin-tsdoc ≥0.5 requires the eslint package at load time, which oxlint consumers no longer install).

版本与发布记录

@alxwlw/oxlint-config 共发布 19 个版本,首次发布于 2026/09/18;过去 12 个月发布了 19 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
1.9.2latest2026/11/043 天前
1.9.12026/11/035 天前
1.9.02026/10/299 天前
1.8.02026/10/2612 天前
1.7.12026/10/2216 天前
1.7.02026/10/2216 天前

关于 @alxwlw/oxlint-config 的常见问题

@alxwlw/oxlint-config 是什么?

The alxwlw oxlint canon for oxlint 1.x + oxlint-tsgolint (type-aware): base/node/nest/react/next presets, TypeScript-7-compatible (tsgolint embeds typescript-go).

如何安装 @alxwlw/oxlint-config?

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

@alxwlw/oxlint-config 支持 TypeScript 吗?

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

@alxwlw/oxlint-config 支持 ESM 还是 CommonJS?

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

@alxwlw/oxlint-config 可以商用吗?

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

@alxwlw/oxlint-config 的下载量有多少?

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

@alxwlw/oxlint-config 还在维护吗?

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