@2digits/oxlint-config

中文文档
3.0.6发布于 2026/11/06MITTypeScriptES Module构建来源已验证近 30 天下载 5497

Minimal Oxlint config for 2digits projects.

原始使用文档

@2digits/oxlint-config

Like @2digits/eslint-config, the default export twoDigits(options, ...userConfigs) builds the config from named oxlint-flat-config objects (2digits:javascript, 2digits:typescript/rules, ...). The ts, react, vitest and zod configs are enabled when their package is installed, and accept overrides for their rules. Your flat config objects apply after the built-in ones; later objects win, like ESLint:

import { twoDigits } from '@2digits/oxlint-config';

export default twoDigits(
  {
    ignores: { ignores: ['generated/**'] },
    react: true,
    vitest: { files: ['**/*.check.ts'] },
  },
  { options: { reportUnusedDisableDirectives: 'allow' } },
  { files: ['scripts/**'], rules: { 'no-console': 'off' } },
);

The default preset enables 2digits/padding-line-between-statements: statements require a blank line between them, including variable declarations, control flow, and returns. Consecutive imports may stay grouped; existing import group spacing is preserved. Run Oxlint with --fix to insert missing blank lines.

Override the rule through twoDigits({}, { rules: { '2digits/padding-line-between-statements': 'off' } }), or supply your own spacing policies in its rule options.

The shared preset keeps capitalized-comments enabled for ordinary prose, but preserves case-sensitive fallow-ignore suppression directives, including fallow-ignore-next-line and fallow-ignore-file. The exception matches the directive family at the start of a comment; prose mentioning a directive remains checked.

The native autofix regression loads the built default export (twoDigits()) without consumer overrides and checks both directive spellings byte-for-byte after two autofix passes. It also verifies lowercase prose is reported and fixed, already capitalized prose is unchanged, and similarly named prose is still fixed.

Verified with the package's native Oxlint 1.86.0 and Node.js 24.21.0. Vite+ 1.0.0 bundles Oxlint 1.85.0 separately; the regression invokes the package's Oxlint CLI directly and removes Vite+'s VP_VERSION loader selection and NAPI_RS_NATIVE_LIBRARY_PATH binary override from its child environment. This verifies comment preservation, not Fallow's dead-code analysis.

After building the workspace, run the package's tests with vpr test from this directory.

版本与发布记录

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

版本发布日期距今
3.0.6latest2026/11/06今天
3.0.52026/11/041 天前
3.0.42026/11/033 天前
3.0.32026/11/023 天前
3.0.22026/11/015 天前
3.0.12026/10/288 天前

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

@2digits/oxlint-config 是什么?

Minimal Oxlint config for 2digits projects.

如何安装 @2digits/oxlint-config?

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

@2digits/oxlint-config 支持 TypeScript 吗?

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

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

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

@2digits/oxlint-config 可以商用吗?

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

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

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

@2digits/oxlint-config 还在维护吗?

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