# @fullstory/eslint-plugin-annotate-react 中文文档

规范地址：https://npmcn.com/package/%40fullstory/eslint-plugin-annotate-react/

版本：0\.0\.10
npm 元数据更新时间：2023-07-31T17:02:41.600Z
中文译文更新时间：2026-11-15T16:50:50.510Z
软件包许可：MIT

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

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

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

- 包体积（解压后）：27.1 kB，9 个文件
- TypeScript 类型：未声明
- 运行依赖：0 个
- 首次发布：2022-07-26T18:33:57.800Z
- 最新版本发布：2023-07-31T17:02:41.490Z
- 近 30 天下载量：2371（2026-10-16 至 2026-11-14，npm 官方下载统计）
- 已发布版本数：11（近 12 个月 0 个）

## 中文简介

用于注释反应组件的ESLint插件.

## 安装

```sh
npm install @fullstory/eslint-plugin-annotate-react
```

也可以使用：`pnpm add @fullstory/eslint-plugin-annotate-react`、`yarn add @fullstory/eslint-plugin-annotate-react`、`bun add @fullstory/eslint-plugin-annotate-react`

## README

# @ fulstory/eslint-plugin-annotate- react 页面存档备份,存于互联网档案馆

为 React 组件添加“ 数据属性” 的 ESLint 插件 。 此插件的目的是自动制作 Css 选择器. 以下是一个例子:

```
const MyComponent = () => (
  <div />
);
```

此插件将自动修正并添加 `data-component` 向 div 显示 :

```
const MyComponent = () => (
  <div data-component="MyComponent" />
);
```

此插件的用意是不被太评价 。 一般来说,这种方法是在有明显的方法时向开发者建议添加"数据组件",但在有疑问的情况下,插件会倾向于安静. 点击以了解更多 [涉及的案件](https://npmcn.com/package/%40fullstory/eslint-plugin-annotate-react/docs/covered-cases.md)。 。 。 .

_说明: 此插件无法保证 `data-component` 如果顶级元素是另一个回放组件,道克会实际到达DOM节点. 为了有效工作,确保你身体正常 [使用 JSX 扩展语法转发道具](https://react.dev/learn/passing-props-to-a-component#forwarding-props-with-the-jsx-spread-syntax)。 。 。 ._

## 安装

你首先需要安装 [ESLint 语录](https://eslint.org/)数字 :

```sh
npm i eslint --save-dev
```

下一个,安装 `@fullstory/eslint-plugin-annotate-react`数字 :

```sh
npm install @fullstory/eslint-plugin-annotate-react --save-dev
```

## 使用量

添加 `@fullstory/eslint-plugin-annotate-react` 到您的插件区 `.eslintrc` 配置文件 。 你可以省略这个 `eslint-plugin-` 前缀 :

```json
{
  "plugins": ["@fullstory/annotate-react"]
}
```

然后在规则章节下配置您想要使用的规则 .

```json
{
  "rules": {
    "@fullstory/annotate-react/data-component": "error"
  }
}
```

## 维护此插件

测试可以使用

```
npm run test
```

## 支持的规则

### @ fulstory/ 注释- react/ data- 组件

.

## 释放

运行此命令以缓冲版本, 按下标记, 并在 GitHub 上创建发布 :

```sh
npx np <patch | minor | major> --no-publish --no-tests
```

## 常见问题

### @fullstory/eslint-plugin-annotate-react 是什么？

用于注释反应组件的ESLint插件\.

### 如何安装 @fullstory/eslint-plugin-annotate-react？

在项目目录运行 npm install @fullstory/eslint-plugin-annotate-react，或使用 pnpm add / yarn add / bun add。

### @fullstory/eslint-plugin-annotate-react 支持 TypeScript 吗？

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

### @fullstory/eslint-plugin-annotate-react 可以商用吗？

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

### @fullstory/eslint-plugin-annotate-react 的下载量有多少？

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

### @fullstory/eslint-plugin-annotate-react 还在维护吗？

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

