# @basenative/eslint-config 中文文档

规范地址：https://npmcn.com/package/%40basenative/eslint-config/

版本：3\.0\.0
npm 元数据更新时间：2026-10-31T13:46:57.055Z
中文译文更新时间：2026-10-31T16:50:54.069Z
软件包许可：Apache-2\.0

本文由上游 README 机器翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/%40basenative/eslint-config
原文对照：https://npmcn.com/package/%40basenative/eslint-config/?lang=original
项目主页：https://github.com/DuganLabs/BaseNative/tree/main/packages/eslint-config#readme
源码仓库：https://github.com/DuganLabs/BaseNative

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：11.3 kB，8 个文件
- 模块格式：ES Module
- TypeScript 类型：未声明
- 运行依赖：3 个
- peer 依赖：eslint \>=9\.0\.0
- 首次发布：2026-10-18T05:29:10.053Z
- 最新版本发布：2026-10-31T13:46:56.764Z
- 已发布版本数：11（近 12 个月 11 个）

## 中文简介

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

## 安装

```sh
npm install @basenative/eslint-config
```

也可以使用：`pnpm add @basenative/eslint-config`、`yarn add @basenative/eslint-config`、`bun add @basenative/eslint-config`

## README

# @basenative / eslint-config

共享ESLint平面配置预设DuganLabs项目。一个观点，一个来源。

## 安装

```bash
pnpm add -D eslint @basenative/eslint-config
```

## 使用

选择与运行时匹配的预设。在 `eslint.config.js`：

```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;
```

## 组成

预设导出一个数组-扩展它：

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

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

## 里面有什么？

-   `@eslint/js` 推荐设置
-   下划线前缀免除未使用的变量/参数/捕获的错误
-   `no-eval` / `no-implied-eval` / `no-new-func` (安全基线)
-   `eqeqeq` 聪明, `no-var`， `prefer-const`
-   Worker预设块（仅限节点的全局变量）`process`， `Buffer`， `__dirname`， `__filename`）
-   更美观的兼容性-禁用格式化规则

## 链接

-   碱性单氧- [https://github.com/DuganLabs/basenative](https://github.com/DuganLabs/basenative)
-   问题- - - - - - [https://github.com/DuganLabs/basenative/issues](https://github.com/DuganLabs/basenative/issues)
-   文档- [https://github.com/DuganLabs/basenative#readme](https://github.com/DuganLabs/basenative#readme)

## 许可证

apache - 2.0

## 常见问题

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

