# @automattic/eslint-config-target-es 中文文档

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

版本：7\.0\.0
npm 元数据更新时间：2026-11-06T18:39:01.436Z
中文译文更新时间：2026-11-07T06:53:48.992Z
软件包许可：MIT

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

原始 npm 页面：https://www.npmjs.com/package/%40automattic/eslint-config-target-es
原文对照：https://npmcn.com/package/%40automattic/eslint-config-target-es/?lang=original
项目主页：https://github.com/Automattic/jetpack/tree/HEAD/projects/js-packages/eslint-config-target-es/README.md#readme
源码仓库：https://github.com/Automattic/eslint-config-target-es

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

- 包体积（解压后）：52.6 kB，17 个文件
- 模块格式：CommonJS
- TypeScript 类型：未声明
- 运行依赖：4 个
- peer 依赖：eslint \>=4\.19\.1，globals \>=15\.4\.0，eslint-plugin-es-x ^8\.0\.0 \|\| ^9\.0\.0
- 首次发布：2021-11-17T15:01:44.181Z
- 最新版本发布：2026-09-17T16:14:48.323Z
- 近 30 天下载量：71947（2026-10-07 至 2026-11-05，npm 官方下载统计）
- 已发布版本数：18（近 12 个月 3 个）

## 中文简介

ESLint sharable config来激活基于浏览器列表目标的eslint-plugin-es-x检查.

## 安装

```sh
npm install @automattic/eslint-config-target-es
```

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

## README

# eslint 配置目标

要激活的 ESLint 可共享配置 [埃斯林特-插头-s-x](https://www.npmjs.com/package/eslint-plugin-es-x) 根据 [浏览器列表](https://www.npmjs.com/package/browserslist) 浏览器目标及 [MDN 浏览器兼容性数据](https://www.npmjs.com/package/@mdn/browser-compat-data)。 。 。 .

## 安装

一般来说,你会通过你的软件包管理器安装这个,例如.

```
npm install --save-dev eslint eslint-plugin-es-x @automattic/eslint-config-target-es
```

## 使用量

首先,你可能会想建立一个 [浏览器列表](https://www.npmjs.com/package/browserslist) 配置 .

那你就用这个像其它的可口的 `eslint.config.js` 或者说 `.eslintrc.*` 文档。 提供三种配置.

-   仅检查语言特征, 如无线连接, 使用“ 语言 ” 配置 .
-   只检查内建内容, 如承诺, 弱参考, 以及 RegExp 的各种特性, 请使用“ 内建内容” 配置 .
-   检查两者,使用"所有"配置.

对于 `eslint.config.js`,这看起来可能是这样:

```js
import eslintConfigTargetEs from '@automattic/eslint-config-target-es/flat/language';

export default [
    eslintConfigTargetEs,
    // etc
];
```

而对于斯林特克,你想

```js
{
    extends: [ '@automattic/eslint-config-target-es/rc/language' ],
}
```

对于后向相容性, Eslintrac 配置也可以不使用 `/rc/` 路径组件(例如: `@automattic/eslint-config-target-es/language`),以及 `@automattic/eslint-config-target-es` 等同为 `@automattic/eslint-config-target-es/rc/all`。 。 。 .

### 正在检查已建文件

如果您想要检查您的已建文件, 以确保您没有省略需要转录的软件包, 您可能会创建 `validate-es.config.js` 像这样

```js
module.exports = {
    root: true,
    extends: [ '@automattic/eslint-config-target-es/rc/language' ],
    env: {
        // Whatever environments you need.
    },
};
```

然后像运行 eslint

```
eslint --no-eslintrc --no-inline-config --config validate-es.config.js --no-ignore build/
```

避免任何内含指令的错误.

平面配置可以做类似的事情.

### 高级用途

您可以导入或要求 `@automattic/eslint-config-target-es/functions` 以获取一些可用于构建自己配置的功能.

由于浏览器列表和MDN使用不同的浏览器代码, `getAllBrowsers( { query: } )` 将使用浏览器列表查询并返回一个带有 MDN 浏览器代码和每个匹配版本的对象.

`getRules( { query:, builtins: } )` 将返回规则配置。 设定 `builtins` 用于"已建",假用于"语言",或无效/未定义为"所有".

### 洞穴

由浏览器列表所支持的一些浏览器在MDN数据(如:Opera Mini)中不可用,或者不再被更新(如:Internet Explorer). 在此类没有数据的情况下,假定支持特征。 设置环境变量 `DEBUG=@automattic/eslint-config-target-es:warn` 生成消息.

## 警卫

需要报告安全弱点吗? 转到 [https://automattic.com/security/ (中文(中国大陆) )](https://automattic.com/security/) 或者直接到我们的安全漏洞赏金网站 [https://hackerone.com/自失常症](https://hackerone.com/automattic)。 。 。 .

## 许可证

eslint-config-target-es的许可证根据 [GNU 通用公共许可证 v2( 或以后)](https://npmcn.com/package/%40automattic/eslint-config-target-es/LICENSE.txt)

\- 说吧

## 常见问题

### @automattic/eslint-config-target-es 是什么？

ESLint sharable config来激活基于浏览器列表目标的eslint-plugin-es-x检查\.

### 如何安装 @automattic/eslint-config-target-es？

在项目目录运行 npm install @automattic/eslint-config-target-es，或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖：eslint（\>=4\.19\.1）、eslint-plugin-es-x（^8\.0\.0 \|\| ^9\.0\.0）。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖，Yarn 需要手动安装。

### @automattic/eslint-config-target-es 支持 TypeScript 吗？

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

### @automattic/eslint-config-target-es 支持 ESM 还是 CommonJS？

以 CommonJS 形式发布，可以直接 require\(\)；在 ES Module 项目中也可以用 import 引入（Node\.js 会把 module\.exports 作为默认导出）。

### @automattic/eslint-config-target-es 可以商用吗？

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

### @automattic/eslint-config-target-es 的下载量有多少？

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

### @automattic/eslint-config-target-es 还在维护吗？

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

