@aivenio/eslint-config-aiven

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

ESLint configuration, following the styleguide of aiven.io

原始使用文档
文档目录5 节
  1. Usage
  2. Install recommended base
  3. Install for React
  4. Development
  5. How to create a new release

eslint-config-aiven

Our internal ESLint and prettier configuration. We want to autoformat code like prettier does, but also do more static checks that eslint does. To do both, we use eslint-plugin-prettier and eslint acts as the frontend to check and autofix style and other issues.

The configuration is split into:

  • @aivenio/eslint-config-aiven
    • Recommended base configuration for TypeScript.
  • @aivenio/eslint-config-aiven/react
    • Base + React additions.
  • @aivenio/eslint-config-aiven/typescript-type-checked

Usage

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

  2. Create an eslint.config.js file in your repository root and select which configuration to use:

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 */ });

When using eslint-config-aiven/react, install the required peer dependencies: eslint-plugin-react, eslint-plugin-react-hooks and eslint-plugin-jsx-a11y.

  1. Setup npm scripts in package.json
  "eslint:fix": "eslint --fix \"src/**/*.{ts,tsx}\"",
  "eslint:check": "eslint \"src/**/*.{ts,tsx}\"",
  1. Remember to setup a CI task to lint source code. See .github/workflows/test.yml for a GH action example.

Install for React

  1. Follow all steps in "Install recommended base" first

  2. Install additional peer dependencies

npm i --save-dev eslint-plugin-jsx-a11y
npm i --save-dev eslint-plugin-react
  1. Change the eslint.config.js in your repository to have the following contents:
import reactConfig from '@aivenio/eslint-config-aiven/react';
import { defineConfig } from 'eslint/config';

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

Development

How to create a new release

Locally:

  1. Run npm run release -- --bump <bump> (all the dashes are needed) where bump is one of major, minor or patch.

    This command will automatically checkout a release branch, commit the version bump, and open your browser to submit a PR.

  2. Review the PR created, and merge it to main. GH actions will handle the rest.

版本与发布记录

@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 configuration, following the styleguide of 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 和提交记录判断。