@aivenio/eslint-config-aiven

中文文档
11.0.0发布于 2026/05/21MITES Module近 30 天下载 3万

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

中文使用文档
文档目录5 节
  1. 使用量
  2. 安装建议的基础
  3. 安装用于反应
  4. 发展
  5. 如何创建新版本

埃斯林特- 配置- aiven

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

配置分为:

  • @aivenio/eslint-config-aiven
    • 为 TypeScript 推荐的基础配置 .
  • @aivenio/eslint-config-aiven/react
    • 基数 + 反应加分.
  • @aivenio/eslint-config-aiven/typescript-type-checked

使用量

  1. npm install @aivenio/eslint-config-aiven

  2. 创建一个 eslint.config.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。 。 。 .

  1. 在 package.json 中设置 npm 脚本
  "eslint:fix": "eslint --fix \"src/**/*.{ts,tsx}\"",
  "eslint:check": "eslint \"src/**/*.{ts,tsx}\"",
  1. 记住设置一个 CI 任务来插入源代码 。 见 .github/工作流程/测试.yml 用于GH动作实例.

安装用于反应

  1. 首先在“安装推荐基地”中遵循所有步骤

  2. 安装额外的同伴依赖关系

npm i --save-dev eslint-plugin-jsx-a11y
npm i --save-dev eslint-plugin-react
  1. 改变 eslint.config.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 共发布 40 个版本,首次发布于 2020/08/03;过去 12 个月发布了 4 个版本。

版本发布日期距今
11.0.0latest2026/05/215 个月前
10.0.02026/01/289 个月前
9.0.02025/11/2011 个月前
8.0.02025/11/1911 个月前
7.7.02025/03/181.6 年前
7.6.02025/03/111.7 年前

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

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