# @flexifin/eslint-config 中文文档

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

版本：2\.7\.6
npm 元数据更新时间：2026-05-18T14:01:43.095Z
中文译文更新时间：2026-11-14T22:34:58.626Z
软件包许可：UNLICENSED

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

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

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

- 包体积（解压后）：638 kB，6 个文件
- 模块格式：ES Module
- TypeScript 类型：包内自带
- Node.js 要求：\>=24\.0\.0
- 运行依赖：23 个
- peer 依赖：eslint \*，prettier \*，typescript \*
- 首次发布：2024-09-27T09:46:43.170Z
- 最新版本发布：2026-05-18T14:01:42.988Z
- 近 30 天下载量：11610（2026-10-15 至 2026-11-13，npm 官方下载统计）
- 已发布版本数：38（近 12 个月 19 个）

## 中文简介

通过几个FF项目共享共同来源的代码服务级回波.

## 安装

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

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

## README

# 弹性/弹性配置

通过几个FF项目共享共同来源的代码服务级回波.

## 使用量

更新 Eslint 到版本 10 :

```bash
npm install eslint@^10
```

从您的工程中删除这些软件包 :

```bash
npm remove prettier \
  @typescript-eslint/parser \
  @typescript-eslint/eslint-plugin \
  eslint-plugin-prefer-arrow-functions \
  eslint-plugin-unused-imports \
  eslint-config-prettier \
  eslint-plugin-prettier \
  eslint-plugin-react \
  eslint-plugin-unicorn
```

安装软件包 :

```sh
# npm
npm install -D @flexifin/eslint-config

# yarn
yarn add -D @flexifin/eslint-config

# pnpm
pnpm add -D @flexifin/eslint-config

# bun
bun install -D @flexifin/eslint-config

# deno
deno install --dev npm:@flexifin/eslint-config
```

## 迁移到 FlexiFin 代码标准

重命名您的工程 root ESLint 配置文件 `eslint.config.mjs` 并修改内容以扩展 FlexiFin 预设 :

```js
import flexiFin from '@flexifin/eslint-config';

export default flexiFin(
  {
    tsconfigRootDir: import.meta.dirname,
    strict: true, // optional (enables type-aware lint: recommendedTypeChecked + stylisticTypeChecked)
    nestSupport: true, // backend (NestJS, Swagger, Node plugin)
    nextSupport: true, // frontend (Next.js, React, Storybook, Playwright, i18next, TanStack Query, a11y)
    plugins: {
      // Every plugin defaults to true EXCEPT `jest` (off — Vitest is the default test runner).
      // Set false to opt out individually. Jest projects opt in:
      // jest: true, vitest: false,
      //
      // Note: TypeScript support (parser + @typescript-eslint plugin) is always on — it is
      // infrastructure, not a toggleable opinion. Override individual TS rules via userConfigs.
    },
    ignores: [
      // ignore paths
    ],
  },
  // Rule overrides go in subsequent userConfig arguments — they apply at the end of the
  // chain and override every preset rule. Add as many as you need; scope by `files` when needed.
  {
    rules: {
      'unicorn/no-array-reduce': 'off',
    },
  }
);
```

真实世界的例子 :

```js
import flexiFin from '@flexifin/eslint-config';

export default flexiFin(
  {
    nextSupport: true,
    ignores: ['src/_api'],
  },
  {
    rules: {
      'unicorn/no-array-reduce': 'off',
    },
  },
  {
    files: ['**/*.spec.ts'],
    rules: {
      '@typescript-eslint/no-explicit-any': 'off',
    },
  }
);
```

将您的工程根 Pretier 配置文件重命名为 `prettier.config.mjs` 并修改内容以扩展 FlexiFin 预设 :

```js
import flexiFin from '@flexifin/eslint-config/prettier';

export default flexiFin();
```

## 静默对等依赖性警告

一些捆绑的插件声明不应用每个工程的对等点: `@darraghor/eslint-plugin-nestjs-typed` 打开对等提示 `class-validator` (仅与雀巢JS应用有关), `eslint-plugin-jsx-a11y` 仍被钉入ESLint 9,以及 `eslint-plugin-storybook` 需要故事书 10.3.6+。 将以下内容添加到您的单曲根 `package.json` 安静的噪音:

```json
{
  "pnpm": {
    "peerDependencyRules": {
      "allowedVersions": {
        "eslint-plugin-jsx-a11y>eslint": "10",
        "eslint-plugin-storybook>storybook": ">=10.3.5"
      },
      "ignoreMissing": ["class-validator"]
    }
  }
}
```

NestJS 应用程序已经使用 `class-validator` 在运行时间,所以 `ignoreMissing` 条目只包含前端 / 非后端软件包的事务 – 保持其单列全宽,无论项目类型如何,警告都会消失.

批准土建脚本(`unrs-resolver` ),运行 `pnpm approve-builds` 一次 一次吗.

## 贡献者

[![](https://contrib.rocks/image?repo=flexifincz/eslint-config)](https://github.com/flexifincz/eslint-config/graphs/contributors)

* * *

_自动更新 [自动](https://automd.unjs.io/)_

## 常见问题

### @flexifin/eslint-config 是什么？

通过几个FF项目共享共同来源的代码服务级回波\.

### 如何安装 @flexifin/eslint-config？

在项目目录运行 npm install @flexifin/eslint-config，或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖：eslint（\*）、prettier（\*）、typescript（\*）。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖，Yarn 需要手动安装。

### @flexifin/eslint-config 支持 TypeScript 吗？

支持。包内自带 TypeScript 类型声明（package\.json 声明了 types 入口），安装后即可获得类型提示，无需再安装 @types 包。

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

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

### @flexifin/eslint-config 需要什么版本的 Node\.js？

package\.json 的 engines 字段要求 Node\.js \>=24\.0\.0。版本不符时 npm 默认只给出警告，开启 engine-strict 后会拒绝安装。

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

@flexifin/eslint-config 使用 UNLICENSED 许可。作者声明为 UNLICENSED，即不授予公开使用许可（与公共领域的 Unlicense 不同）。使用前需获得作者授权。以上为概括，不构成法律意见，请以许可原文为准。

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

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

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

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

