# @aivenio/eslint-config-aiven 中文文档

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

版本：11\.0\.0
npm 元数据更新时间：2026-11-02T13:30:53.261Z
中文译文更新时间：2026-11-05T20:14:19.199Z
软件包许可：MIT

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

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

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

- 包体积（解压后）：16.4 kB，12 个文件
- 模块格式：ES Module
- TypeScript 类型：未声明
- 运行依赖：5 个
- peer 依赖：react 17\.x \|\| 18\.x \|\| 19\.x，eslint \>=9，eslint-plugin-react \>=7，eslint-plugin-jsx-a11y \>=6，eslint-plugin-react-hooks \>=4，eslint-import-resolver-typescript \>=4
- 首次发布：2020-08-03T09:54:36.992Z
- 最新版本发布：2026-05-21T14:09:54.791Z
- 近 30 天下载量：30134（2026-10-05 至 2026-11-03，npm 官方下载统计）
- 已发布版本数：40（近 12 个月 4 个）

## 中文简介

ESLint 配置,遵循 aiven.io 的样式指南

## 安装

```sh
npm install @aivenio/eslint-config-aiven
```

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

## README

# 埃斯林特- 配置- aiven

我们的内部ESLint和更漂亮的配置。 我们想要像更美的一样自动格式化代码, 但也做更多的静态检查,像斯林那样。 为了做到两者,我们用 [埃斯林特- 插孔- prettier](https://github.com/prettier/eslint-plugin-prettier) 和 eslint 充当检查和自动固定样式以及其他问题的前端.

配置分为:

-   `@aivenio/eslint-config-aiven`
    -   为 TypeScript 推荐的基础配置 .
-   `@aivenio/eslint-config-aiven/react`
    -   基数 + 反应加分.
-   `@aivenio/eslint-config-aiven/typescript-type-checked`
    -   需要的基数+ TS 规则 [已键入](https://typescript-eslint.io/linting/typed-linting/)

## 使用量

### 安装建议的基础

1.  `npm install @aivenio/eslint-config-aiven`
    
2.  创建一个 `eslint.config.js` 文件中的文件,并选择要使用的配置 :
    

```js
import baseConfig from '@aivenio/eslint-config-aiven';
import { defineConfig } from 'eslint/config';

export default defineConfig(baseConfig, { /* further configuration */ });
// Or choose one of the variants:
// import reactConfig from '@aivenio/eslint-config-aiven/react';
// import typeCheckedConfig from '@aivenio/eslint-config-aiven/typescript-type-checked';
// export default defineConfig(reactConfig, typeCheckedConfig, { /* further configuration */ });
```

使用时 `eslint-config-aiven/react`,安装所需的对等依赖: `eslint-plugin-react`, (中文(简体) ), `eslint-plugin-react-hooks` 财务报告和审定财务报表 `eslint-plugin-jsx-a11y`。 。 。 .

3.  在 package.json 中设置 npm 脚本

```js
  "eslint:fix": "eslint --fix \"src/**/*.{ts,tsx}\"",
  "eslint:check": "eslint \"src/**/*.{ts,tsx}\"",
```

4.  记住设置一个 CI 任务来插入源代码 。 见 [.github/工作流程/测试.yml](https://npmcn.com/package/%40aivenio/eslint-config-aiven/.github/workflows/test.yml) 用于GH动作实例.

### 安装用于反应

1.  首先在“安装推荐基地”中遵循所有步骤
    
2.  安装额外的同伴依赖关系
    

```bash
npm i --save-dev eslint-plugin-jsx-a11y
npm i --save-dev eslint-plugin-react
```

3.  改变 `eslint.config.js` 在您的仓库中设置以下内容:

```js
import reactConfig from '@aivenio/eslint-config-aiven/react';
import { defineConfig } from 'eslint/config';

export default defineConfig(reactConfig, { /* further configuration */ });
```

## 发展

### 如何创建新版本

当地:

1.  运行 `npm run release -- --bump <bump>` _(所有破折号都需要)_ 撞伤是其中之一 `major`, (中文(简体) ), `minor` 或者说 `patch`。 。 。 .
    
    此命令将自动检查一个发布分支, 输入版本突起, 并打开您的浏览器提交 PR .
    
2.  审查创建的公关,并合并到主机上. GH动作会处理其余的.

## 常见问题

### @aivenio/eslint-config-aiven 是什么？

ESLint 配置,遵循 aiven\.io 的样式指南

### 如何安装 @aivenio/eslint-config-aiven？

在项目目录运行 npm install @aivenio/eslint-config-aiven，或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖：react（17\.x \|\| 18\.x \|\| 19\.x）、eslint（\>=9）、eslint-plugin-react（\>=7）、eslint-plugin-jsx-a11y（\>=6）、eslint-plugin-react-hooks（\>=4）、eslint-import-resolver-typescript（\>=4）。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖，Yarn 需要手动安装。

### @aivenio/eslint-config-aiven 支持 TypeScript 吗？

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

### @aivenio/eslint-config-aiven 支持 ESM 还是 CommonJS？

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

### @aivenio/eslint-config-aiven 可以商用吗？

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

### @aivenio/eslint-config-aiven 的下载量有多少？

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

### @aivenio/eslint-config-aiven 还在维护吗？

最新版本 11\.0\.0 发布于 2026/05/21（5 个月前）；至今共发布 40 个版本，其中过去 12 个月发布了 4 个；首次发布于 2020/08/03。发布频率只是参考信号：功能稳定的工具可能很少需要更新，建议结合源码仓库的 issue 和提交记录判断。

