@basenative/eslint-config

中文文档
3.0.0发布于 2026/10/31Apache-2.0ES Module构建来源已验证

Shared ESLint flat-config for DuganLabs projects — security, hygiene, zero-noise defaults

原始使用文档
文档目录6 节
  1. Install
  2. Use
  3. Compose
  4. What's in it
  5. Links
  6. License

@basenative/eslint-config

Shared ESLint flat-config preset for DuganLabs projects. One opinion, one source.

Install

pnpm add -D eslint @basenative/eslint-config

Use

Pick the preset matching your runtime. In eslint.config.js:

// SPA / browser
import config from "@basenative/eslint-config/browser";
export default config;

// Node / scripts
import config from "@basenative/eslint-config/node";
export default config;

// Cloudflare Workers / Pages Functions
import config from "@basenative/eslint-config/worker";
export default config;

// React
import config from "@basenative/eslint-config/react";
export default config;

Compose

The presets export an array — extend it:

import base from "@basenative/eslint-config/browser";

export default [
  ...base,
  {
    rules: {
      "no-console": "warn",
    },
  },
];

What's in it

  • @eslint/js recommended set
  • Underscore-prefix exempt for unused vars / args / caught errors
  • no-eval / no-implied-eval / no-new-func (security baseline)
  • eqeqeq smart, no-var, prefer-const
  • Worker preset blocks Node-only globals (process, Buffer, __dirname, __filename)
  • Prettier compatibility — formatting rules disabled

License

Apache-2.0

版本与发布记录

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

版本发布日期距今
3.0.0latest2026/10/312 天前
2.4.02026/10/268 天前
2.3.22026/10/2212 天前
2.3.12026/10/2212 天前
2.3.02026/10/2212 天前
2.2.02026/10/2113 天前

关于 @basenative/eslint-config 的常见问题

@basenative/eslint-config 是什么?

为DuganLabs项目共享ESLint平面配置-安全,卫生,零噪音默认值

如何安装 @basenative/eslint-config?

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

@basenative/eslint-config 支持 TypeScript 吗?

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

@basenative/eslint-config 支持 ESM 还是 CommonJS?

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

@basenative/eslint-config 可以商用吗?

@basenative/eslint-config 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@basenative/eslint-config 还在维护吗?

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