# @aleph-alpha/eslint-config-frontend 中文文档

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

版本：0\.7\.1
npm 元数据更新时间：2026-10-28T11:38:12.906Z
中文译文更新时间：2026-11-05T21:54:01.736Z
软件包许可：Apache-2\.0

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

原始 npm 页面：https://www.npmjs.com/package/%40aleph-alpha/eslint-config-frontend
原文对照：https://npmcn.com/package/%40aleph-alpha/eslint-config-frontend/?lang=original
项目主页：https://docs.aleph-alpha.com/

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

- 包体积（解压后）：179 kB，22 个文件
- 模块格式：ES Module
- TypeScript 类型：未声明
- 运行依赖：7 个
- peer 依赖：eslint ^10\.0\.0
- 首次发布：2025-03-10T15:00:36.965Z
- 最新版本发布：2026-08-10T14:15:40.722Z
- 近 30 天下载量：15026（2026-10-06 至 2026-11-04，npm 官方下载统计）
- 已发布版本数：193（近 12 个月 86 个）

## 中文简介

_@aleph-alpha/eslint-config-frontend 页面存档备份,存于互联网档案馆_

## 安装

```sh
npm install @aleph-alpha/eslint-config-frontend
```

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

## README

## ESLint 配置

_@aleph-alpha/eslint-config-frontend 页面存档备份,存于互联网档案馆_

Aleph Alph Alpha前端工程的共享,可混合的ESLint平面配置. 要求数 **ESLint 10+ (英语)**。 。 。 .

### 安装

```bash
pnpm add -D @aleph-alpha/eslint-config-frontend eslint
```

### 快速启动

创建一个 `eslint.config.mjs` 在您的项目中 :

```js
import { base } from '@aleph-alpha/eslint-config-frontend';

export default [...base];
```

就是这样。 这取代了整个 创造-Vue锅炉板 给你 `@eslint/js` 建议 + `eslint-plugin-vue` 建议 + 类型脚本解析 + org 标准 威仪规则.

### 可编译配置

软件包输出四个配置,它们可以一起组成:

| 导出 | 上面写的 |
| --- | --- |
| `base` | `@eslint/js` 建议, `eslint-plugin-vue` 建议, TS 解析器, Vue 样式规则, 全局 |
| `tsRecommended` | `@typescript-eslint` 插件 + `typescript-eslint` 建议的规则 + org 标准重度调整 |
| `strict` | `eslint-plugin-sonarjs` 建议的规则 |
| `a11y` | `eslint-plugin-vuejs-accessibility` 建议的无障碍规则 |

### 用法实例

**Vue + TS 项目(最常见的):**

```js
import { base } from '@aleph-alpha/eslint-config-frontend';
import skipFormatting from '@vue/eslint-config-prettier/skip-formatting';

export default [...base, skipFormatting];
```

**使用类型脚本规则 :**

```js
import { base, tsRecommended } from '@aleph-alpha/eslint-config-frontend';
import skipFormatting from '@vue/eslint-config-prettier/skip-formatting';

export default [...base, ...tsRecommended, skipFormatting];
```

**上面有代码质量规则( sonarjs) :**

```js
import { base, tsRecommended, strict } from '@aleph-alpha/eslint-config-frontend';
import skipFormatting from '@vue/eslint-config-prettier/skip-formatting';

export default [...base, ...tsRecommended, ...strict, skipFormatting];
```

**全面设置可访问性 :**

```js
import { base, tsRecommended, strict, a11y } from '@aleph-alpha/eslint-config-frontend';
import skipFormatting from '@vue/eslint-config-prettier/skip-formatting';

export default [...base, ...tsRecommended, ...strict, ...a11y, skipFormatting];
```

**在 Nx 工作空间** (减少) `nx.configs['flat/typescript']` 财务报告和审定财务报表 `nx.configs['flat/javascript']` —— 说 `tsRecommended` 拥有 `@typescript-eslint` 登记和规则的制定:

```js
import nx from '@nx/eslint-plugin';
import { base, tsRecommended, strict, a11y } from '@aleph-alpha/eslint-config-frontend';

export default [
  ...nx.configs['flat/base'],
  ...tsRecommended,
  ...base,
  ...strict,
  ...a11y,
  // ...workspace-specific blocks
];
```

**有特定项目覆盖:**

```js
import { base, tsRecommended, strict } from '@aleph-alpha/eslint-config-frontend';
import skipFormatting from '@vue/eslint-config-prettier/skip-formatting';

export default [
  ...base,
  ...tsRecommended,
  ...strict,
  {
    rules: {
      'no-console': 'warn',
      'vue/block-order': ['error', { order: ['i18n', 'script', 'template', 'style'] }],
    },
  },
  skipFormatting,
];
```

**有vitest和剧作家(常见模式):**

```js
import { base } from '@aleph-alpha/eslint-config-frontend';
import pluginVitest from '@vitest/eslint-plugin';
import pluginPlaywright from 'eslint-plugin-playwright';
import skipFormatting from '@vue/eslint-config-prettier/skip-formatting';

export default [
  ...base,
  {
    ...pluginVitest.configs.recommended,
    files: ['src/**/__tests__/*'],
  },
  {
    ...pluginPlaywright.configs['flat/recommended'],
    files: ['e2e/**/*.{test,spec}.{js,ts,jsx,tsx}'],
  },
  skipFormatting,
];
```

### 包含什么

#### `base`

-   [`@eslint/js`](https://eslint.org/docs/latest/rules/) 建议的规则
-   [`eslint-plugin-vue`](https://eslint.vuejs.org/rules/) `flat/recommended` 规则
-   [`vue-eslint-parser`](https://github.com/vuejs/vue-eslint-parser) 与 [`@typescript-eslint/parser`](https://typescript-eslint.io/packages/parser)
-   浏览器和 Node.js 全球
-   奥尔格标准 Vue 规则: PascalCase 组件、 短手指令、 范围样式、 块排序

#### `tsRecommended`

-   范围 `**/*.{ts,tsx,cts,mts,vue}` (命令独立——安全扩散前后) `base`(中文(简体) )
-   [`typescript-eslint`](https://typescript-eslint.io/users/configs#recommended) `recommended` 配置
-   `@typescript-eslint` 插件注册
-   Org 标准重度调试 : `no-require-imports` 关; `no-empty-function`, (中文(简体) ), `no-inferrable-types`, (中文(简体) ), `no-empty-object-type`, (中文(简体) ), `no-unused-expressions`, (中文(简体) ), `no-non-null-asserted-optional-chain`, (中文(简体) ), `prefer-const`, (中文(简体) ), `no-non-null-assertion`, (中文(简体) ), `no-explicit-any`, (中文(简体) ), `no-unused-vars` 设置为 `warn` 优雅的收养
-   `@typescript-eslint/prefer-as-const`数字 : `error`

#### `strict`

-   [`eslint-plugin-sonarjs`](https://github.com/SonarSource/eslint-plugin-sonarjs#rules) 建议的规则

#### `a11y`

-   [`eslint-plugin-vuejs-accessibility`](https://vue-a11y.github.io/eslint-plugin-vuejs-accessibility/) 建议的规则

### 自定义

每个配置都是由ESLint平面配置对象组成的阵列. 通过在共享配置后添加配置对象来覆盖任意规则 。 关于现有规则的详细情况,见:

-   [参考 ESLint 规则](https://eslint.org/docs/latest/rules/)
-   [类型刻录规则](https://typescript-eslint.io/rules/)
-   [eslint-plugin-vue规则](https://eslint.vuejs.org/rules/)
-   [eslint-plugin-sonarjs规则](https://github.com/SonarSource/eslint-plugin-sonarjs#rules)
-   [ESLint 平面配置文件](https://eslint.org/docs/latest/use/configure/configuration-files)

## 常见问题

### @aleph-alpha/eslint-config-frontend 是什么？

@aleph-alpha/eslint-config-frontend 页面存档备份,存于互联网档案馆

### 如何安装 @aleph-alpha/eslint-config-frontend？

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

### @aleph-alpha/eslint-config-frontend 支持 TypeScript 吗？

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

### @aleph-alpha/eslint-config-frontend 支持 ESM 还是 CommonJS？

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

### @aleph-alpha/eslint-config-frontend 可以商用吗？

@aleph-alpha/eslint-config-frontend 使用 Apache-2\.0 许可。宽松许可：允许商业使用、修改和再分发，并附带明确的专利授权；分发时需保留许可与 NOTICE 文件，修改过的文件要注明改动。以上为概括，不构成法律意见，请以许可原文为准。

### @aleph-alpha/eslint-config-frontend 的下载量有多少？

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

### @aleph-alpha/eslint-config-frontend 还在维护吗？

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

