# @atom\.io/eslint-plugin 中文文档

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

版本：0\.1\.1
npm 元数据更新时间：2026-10-29T08:32:51.220Z
中文译文更新时间：2026-11-07T03:16:13.042Z
软件包许可：MPL-2\.0

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

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

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

- 包体积（解压后）：63.5 kB，14 个文件
- 模块格式：ES Module
- TypeScript 类型：包内自带
- 运行依赖：1 个
- peer 依赖：eslint ^9\.0\.0 \|\| ^10\.0\.0，typescript \>=4\.8\.4 \<6\.1\.0，@typescript-eslint/parser ^8\.0\.0
- 首次发布：2026-10-16T20:10:50.050Z
- 最新版本发布：2026-10-29T08:32:50.870Z
- 近 30 天下载量：20593（2026-10-07 至 2026-11-05，npm 官方下载统计）
- 已发布版本数：4（近 12 个月 4 个）

## 中文简介

ESLint对原子.io状态和交易申报的规则.

## 安装

```sh
npm install @atom.io/eslint-plugin
```

也可以使用：`pnpm add @atom.io/eslint-plugin`、`yarn add @atom.io/eslint-plugin`、`bun add @atom.io/eslint-plugin`

## README

![atom.io logo](https://raw.githubusercontent.com/jeremybanka/atom.io/main/apps/atom.io.fyi/public/favicon.png)

# `@atom.io/eslint-plugin`

[![NPM Version](https://img.shields.io/npm/v/@atom.io/eslint-plugin?style=for-the-badge)](https://www.npmjs.com/package/@atom.io/eslint-plugin)[![Dependencies 1](https://img.shields.io/badge/dependencies-1-0?style=for-the-badge)](https://www.npmjs.com/package/@atom.io/eslint-plugin)[![Coverage](https://img.shields.io/endpoint?url=https%3A%2F%2Frecoverage.cloud%2Fshields%2F665Gbgm4N5b47w7qpruIa%2Feslint-plugin)](https://recoverage.cloud/)[![Types](https://img.shields.io/npm/types/@atom.io/eslint-plugin?style=for-the-badge)](https://www.npmjs.com/package/@atom.io/eslint-plugin)

### ESLint对原子.io状态和交易申报的规则.

### [读取 attom.io.fyi 的文档](https://atom.io.fyi/docs/eslint-plugin)

在ESLint 9或10同时安装此软件包作为开发依赖, `@typescript-eslint/parser` 8,以及一个被支持的TypeScript编译器(4.8.4至6.0.x).

TypeScript同行描述了ESLint使用的编译器API. 您可以用 TypeScript 7 并列构建: 启动模板别名 TypeScript 7 作为 `@typescript/native` 页:1 `tsc` 财务报告和审定财务报表 `@typescript/typescript6` 作为 `typescript` 用于 ESLint 的编译器 API 和单独的 `tsc6` 命令.

这个 `exact-catch-types` 规则需要配置有类型信息的 TypeScript 解析器。 在您的 ESLint 配置中配置解析器 .

选入 `ban-use-effect` 规则禁止 `useEffect` 在应用程序代码中,同时允许 `useLayoutEffect`其诊断与 [反对使用效果](https://atom.io.fyi/docs/against-use-effect) 财务报告和审定财务报表 `node_modules/atom.io/docs/agent/packages/against-use-effect.md` 用于替换指导。 见 [配置和所支持的表格](https://atom.io.fyi/docs/eslint-plugin#ban-use-effect)。 。 。 .

见 [安装指南、配置展览和规则文档](https://atom.io.fyi/docs/eslint-plugin)。当从 `atom.io/eslint-plugin`,将导入改为 `@atom.io/eslint-plugin`; 默认插件导出, 命名 `Rules` 导出、 规则名称和选项不变 .

## 安装

```sh
pnpm add -D @atom.io/eslint-plugin eslint typescript-eslint \
  typescript@npm:@typescript/typescript6@6.0.2 \
  @typescript/native@npm:typescript@7.0.2

```

## 配置

```ts
import atomIO from "@atom.io/eslint-plugin"
import tseslint from "typescript-eslint"

export default tseslint.config(
    {
        ignores: [`dist/**`, `node_modules/**`],
    },
    ...tseslint.configs.recommendedTypeChecked,
    {
        files: [`**/*.{ts,tsx}`],
        languageOptions: {
            parserOptions: {
                projectService: true,
                tsconfigRootDir: import.meta.dirname,
            },
        },
        plugins: {
            "atom.io": atomIO,
        },
        rules: {
            "atom.io/exact-catch-types": `error`,
            "atom.io/explicit-state-types": `error`,
            "atom.io/explicit-transaction-types": `error`,
            "atom.io/naming-convention": `error`,
        },
    },
)

```

## 规则

| 规则 | 说明 |
| --- | --- |
| `atom.io/ban-use-effect` | 禁用 Atom.io 应用程序代码中的反用效果 |
| `atom.io/naming-convention` | 给 Atom.io 资源的可变名称应匹配其密钥属性并遵循一致的格式 |
| `atom.io/exact-catch-types` | 确保当一个错误类型(E)提供给一个原子时,“捕获”属性被设定,其中的所有构造器均可被指定给E. |
| `atom.io/explicit-state-types` | 国家声明必须具有直接传递给它们的通用类型的论据 |
| `atom.io/explicit-transaction-types` | 交易申报必须具有直接传递给它们的通用类型的论据 |

## 常见问题

### @atom\.io/eslint-plugin 是什么？

ESLint对原子\.io状态和交易申报的规则\.

### 如何安装 @atom\.io/eslint-plugin？

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

### @atom\.io/eslint-plugin 支持 TypeScript 吗？

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

### @atom\.io/eslint-plugin 支持 ESM 还是 CommonJS？

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

### @atom\.io/eslint-plugin 可以商用吗？

@atom\.io/eslint-plugin 使用 MPL-2\.0 许可。弱 Copyleft：可以商用，也可以和闭源代码一起使用；但如果分发时修改了 MPL 授权的文件，这些文件的修改需以 MPL 开源。以上为概括，不构成法律意见，请以许可原文为准。

### @atom\.io/eslint-plugin 的下载量有多少？

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

### @atom\.io/eslint-plugin 还在维护吗？

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

