# @azat-io/eslint-config 中文文档

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

版本：2\.103\.0
npm 元数据更新时间：2026-11-04T03:10:52.583Z
中文译文更新时间：2026-11-07T16:44:39.623Z
软件包许可：MIT

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

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

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

- 包体积（解压后）：134 kB，23 个文件
- 模块格式：ES Module
- TypeScript 类型：包内自带
- Node.js 要求：^22\.22\.3 \|\| ^24\.16\.0 \|\| \>=26\.3\.0
- 运行依赖：37 个
- peer 依赖：eslint \>=10\.0\.0
- 首次发布：2024-11-16T21:23:10.833Z
- 最新版本发布：2026-11-04T03:10:52.180Z
- 近 30 天下载量：4663（2026-10-08 至 2026-11-06，npm 官方下载统计）
- 已发布版本数：146（近 12 个月 50 个）

## 中文简介

ESLint 可共享配置

## 安装

```sh
npm install @azat-io/eslint-config
```

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

## README

# ESLint 配置

![ESLint Config Logo](https://raw.githubusercontent.com/azat-io/eslint-config/main/assets/logo.svg)

[![Version](https://img.shields.io/npm/v/@azat-io/eslint-config.svg?color=4a32c3&labelColor=26272b)](https://npmjs.com/package/@azat-io/eslint-config) [![GitHub License](https://img.shields.io/badge/license-MIT-232428.svg?color=4a32c3&labelColor=26272b)](https://github.com/azat-io/eslint-config/blob/main/license.md)

一个全面和灵活的ESLint配置,支持广泛的 框架和环境。 方便地整合干净、一致的代码标准 通过为特定工具和图书馆提供环境,实现所有项目.

此配置涵盖一个简单直接导入的多个设置, 帮助 保持不同项目类型和框架的一致性.

## 使用量

运行 ESLint 需要节点.js `^22.22.3 || ^24.16.0 || >=26.3.0`,匹配 包含插件的要求。 你插入的代码可以瞄准更老的 运行时间.

1.  安装软件包 :

```sh
pnpm add --save-dev eslint @azat-io/eslint-config
```

2.  创建 ESLint 配置文件 `eslint.config.js`数字 :

```js
import eslintConfig from '@azat-io/eslint-config'

export default eslintConfig({
  root: import.meta.dirname,
  perfectionist: true,
  typescript: true,
  react: true,
  node: true,
})
```

3.  添加脚本 `package.json`数字 :

```json
{
  "scripts": {
    "test:js": "eslint \"**/*.{js,ts,jsx,tsx,json}\""
  }
}
```

## 配置

要根据您的项目需要配置 ESLint 规则, 请导入配置 ,并传递每个框架或工具带有选项的对象。 框架和工具 旗帜默认被禁用 。 启用运行时间兼容性检查 自动.

```js
import eslintConfig from '@azat-io/eslint-config'

export default eslintConfig({
  perfectionist: true,
  typescript: true,
  svelte: true,
  vitest: true,
  astro: true,
  react: true,
  qwik: true,
  node: true,
  vue: true,
})
```

### 完美主义者

启用用于排序和组织代码结构的规则,以提高可读性 和一致性.

### 类型标记

添加 TypeScript 特有衬线规则,以确保类型安全并维护 TypeScript最佳做法.

### 丝绒

启用对 Svelte 的支持, 包括对 Svelte 组件的 Linting 规则和 文档.

### 测试

添加对 Vitest 的支持, 调整 linting 以测试文件和做法 在Vitest项目内.

### 天体

Astro 项目配置 ESLint, 对 Astro 文件进行调整 结构与公约.

### 反应

包括针对JSX语法、反应钩和最佳 反应环境中的做法.

### 齐克

添加对 Qwik 的支持, 调整 Qwik 特定语法的林入和 公约.

### 节点

调整为节点环境,处理节点特定全球, 进口和常见做法.

### 声音

添加 Vue 特定的林入规则,支持 Vue 的语法和最佳做法 Vue 组件.

### 运行时间目标

配置读取最近的 `package.json` 浏览器列表配置到 禁用将引入不支持的 API 的规则 。 运行时间覆盖适用于 由启用配置支持的源文件, 使 JSON 文件不受影响 .

```js
import eslintConfig from '@azat-io/eslint-config'

export default eslintConfig({
  root: import.meta.dirname,
  targets: {
    browsers: 'baseline widely available',
    node: '>=22',
  },
  toolingNode: '>=24',
  typescript: true,
})
```

`root` 是用于运行时目标发现的目录或文件 URL。 这个 默认为 `process.cwd()`; 将其设置在单体或运行时 来自另一个目录的ESLint.

`targets` 默认为 `'auto'`。 。 `node` 财务报告和审定财务报表 `browsers` 密钥覆盖 独立自动发现; 仍然检测出省略的密钥,以及 `false` 排除运行时间。 节点J目标来自 `engines.node`,则 浏览器list Node.js查询,后为Node.js 22回落. 赤裸裸的显着 类似版本 `'22.12'` 表示该版本或更新. 这个 `node: true` 旗帜 启用Node.js lint 规则,并与 `targets.node`。 。 。 .

`toolingNode` 为配置文件和文件设置不同的Node.js目标 `scripts/`, (中文(简体) ), `bin/` 财务报告和审定财务报表 `tools/`在配置中只启用了扩展名 包含。 否则工具化会使用被检测到的项目Node.js目标, 包括只使用浏览器的项目.

其他运行时间选项 :

| 选项 | 默认 | 目的 |
| --- | --- | --- |
| `browserslistEnv` | `'production'` | 选择浏览器列表环境 . |
| `pinnedDate` | 支持数据日期 | Pin 相对基线查询,包括共享配置 . |
| `fallback` | `{ node: '22.0.0' }` | 选择后退 Node.js 目标,或禁用 `false`。 。 。 . |
| `missingBrowsers` | `'ignore'` | 忽略缺失的浏览器目标, 使用 `'off'`,或查询. |
| `unknownBrowsers` | `'off'` | 禁用依赖规则或 `'ignore'` 未知浏览器. |
| `ignoreBrowsers` | `['op_mini']` | 替换被忽略的浏览器列表代理列表 . |
| `quiet` | `false` | 在配置设置中保留警告而不打印它们 . |

已解析的目标源、警告和禁用规则,可在 `settings['azat-io/runtime']` 在ESLint语中 `--print-config` 输出。 自定义 `extends` 配置在运行时间覆盖后运行, 所以需要明确的规则选择 优先级.

### 扩展

可以自入自性相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相 示例

```js
import eslintConfig from '@azat-io/eslint-config'

export default eslintConfig({
  extends: [
    {
      rules: {
        'no-undef': 'off',
      },
    },
  ],
})
```

## 插件

此配置使用以下插件 :

-   [@slint/js (英语)](https://github.com/eslint/eslint)
-   [@vitest/eslint-plugin (英语)](https://github.com/vitest-dev/eslint-plugin-vitest)
-   [埃斯林特- 插头- astro](https://github.com/ota-meshi/eslint-plugin-astro)
-   [埃斯林特-插头-德-摩根](https://github.com/azat-io/eslint-plugin-de-morgan)
-   [eslint- 插件依赖](https://github.com/es-tooling/eslint-plugin-depend)
-   [埃斯林特-插孔-进口-升](https://github.com/9romise/eslint-plugin-import-lite)
-   [埃斯林特-插孔-jsdoc](https://github.com/gajus/eslint-plugin-jsdoc)
-   [埃斯林特-插头-jsx-a11y-x](https://github.com/eslint-community/eslint-plugin-jsx-a11y-x)
-   [埃斯林特-插头-n](https://github.com/eslint-community/eslint-plugin-n)
-   [埃斯林特-插孔-包装-json](https://github.com/JoshuaKGoldberg/eslint-plugin-package-json)
-   [埃斯林特-插剂-完美药剂师](https://github.com/azat-io/eslint-plugin-perfectionist)
-   [爱斯林特- 插头- 偏好](https://github.com/thefrontside/javascript/tree/v3/packages/eslint-plugin-prefer-let)
-   [埃斯林特- 插座- 保证](https://github.com/eslint-community/eslint-plugin-promise)
-   [埃斯林特- plugin- qwik](https://github.com/QwikDev/qwik/tree/main/packages/eslint-plugin-qwik)
-   [eslint-plugin- react-down (英语)](https://github.com/Rel1cx/eslint-react)
-   [eslint-plugin- react-hooks (英语)](https://github.com/facebook/react/tree/main/packages/eslint-plugin-react-hooks)
-   [埃斯林特-插头-反应-jsx](https://github.com/Rel1cx/eslint-react)
-   [eslint-plugin-反应-命名-公约](https://github.com/Rel1cx/eslint-react)
-   [eslint-plugin- react-perf](https://github.com/cvazac/eslint-plugin-react-perf)
-   [eslint-plugin- react-web-api (英语)](https://github.com/Rel1cx/eslint-react)
-   [eslint-plugin-反应-x](https://github.com/Rel1cx/eslint-react)
-   [斯林特- plugin- regexp](https://github.com/ota-meshi/eslint-plugin-regexp)
-   [斯林特-plugin- slop (英语)](https://github.com/antfu/eslint-plugin-slop)
-   [埃斯林特- 插孔- sonarjs](https://github.com/SonarSource/SonarJS/tree/master/packages/jsts/src/rules)
-   [斯林特- 插头- 丝绒](https://github.com/sveltejs/eslint-plugin-svelte)
-   [斯林特-插孔-独角兽](https://github.com/sindresorhus/eslint-plugin-unicorn)
-   [斯林特- 插图- vue](https://github.com/vuejs/eslint-plugin-vue)
-   [类型标记- slint](https://github.com/typescript-eslint/typescript-eslint)

## 另见

-   [@azat-io/ai-config](https://github.com/azat-io/ai-config)
-   [@azat-io/ prettier- config](https://github.com/azat-io/prettier-config)
-   [@ azat-io/ stylelint- config](https://github.com/azat-io/stylelint-config)
-   [@ azat-io/ typescript- config](https://github.com/azat-io/typescript-config)

## 许可证

麻省理工学院 [(原始内容存档于2018-09-21). Azat S.](https://azat.io/)

## 常见问题

### @azat-io/eslint-config 是什么？

ESLint 可共享配置

### 如何安装 @azat-io/eslint-config？

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

### @azat-io/eslint-config 支持 TypeScript 吗？

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

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

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

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

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

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

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

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

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

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

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

