# @caspeco/eslint-config-ts 中文文档

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

版本：5\.5\.1
npm 元数据更新时间：2026-10-20T10:39:19.810Z
中文译文更新时间：2026-11-09T06:05:40.735Z
软件包许可：MIT

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

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

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

- 包体积（解压后）：12.2 kB，7 个文件
- 模块格式：ES Module
- TypeScript 类型：包内自带
- 运行依赖：0 个
- peer 依赖：eslint ^9\.39\.4 \|\| ^10\.0\.0，@eslint/js ^9\.39\.4 \|\| ^10\.0\.0，typescript-eslint ^8\.57\.2，eslint-config-prettier ^10\.1\.8，eslint-plugin-check-file ^3\.3\.2，eslint-plugin-baseline-js ^0\.7\.5，eslint-plugin-no-barrel-files ^2\.2\.0
- 首次发布：2025-11-11T09:30:20.730Z
- 最新版本发布：2026-10-20T10:39:19.269Z
- 近 30 天下载量：5122（2026-10-09 至 2026-11-07，npm 官方下载统计）
- 已发布版本数：17（近 12 个月 17 个）

## 中文简介

TypeScript 项目的 Caspeco ESLint 配置

## 安装

```sh
npm install @caspeco/eslint-config-ts
```

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

## README

# @caspeco/slint-config-ts (英语)

用于TypeScript项目的 Caspeco ESLint配置.

## 安装

```bash
npm install --save-dev @caspeco/eslint-config-ts
```

## 使用量

创建一个 `eslint.config.js` 在工程根中的文件 :

```js
import config from "@caspeco/eslint-config-ts";

export default [{ ignores: ["dist/**/*", "build/**/*"] }, ...config];
```

## 包含什么

此配置包括:

-   **类型脚本 ESLint** - 使用 [建议类型](https://typescript-eslint.io/users/configs/#recommended-type-checked) 配置
-   **没有弹匣文件** - 防止桶文件使用(只是再导出索引文件)
-   **文件命名公约** - 执行文件和文件夹的kebab案
-   **高级整合** - 与Pretier格式兼容

## 同伴依赖关系

此软件包需要以下对等依赖( 自动由 npm 7+ 安装) :

-   `@eslint/js`
-   `eslint`
-   `eslint-config-prettier`
-   `eslint-plugin-check-file`
-   `eslint-plugin-no-barrel-files`
-   `typescript-eslint`

见 [软件包.json](https://npmcn.com/package/%40caspeco/eslint-config-ts/package.json) 用于特定版本要求.

## 插件

### 类型标记- slint

使用 [建议类型](https://typescript-eslint.io/users/configs/#recommended-type-checked) 启用了项目服务配置 .

### eslint-plugin-无管文件

[eslint-plugin-无管文件](https://github.com/art0rz/eslint-plugin-no-barrel-files)

我们尽可能不使用枪管文件:

-   减速建造和测试
-   引起循环依赖
-   让树摇得更难

**说明:** 我们允许作为 npm 包消耗的库的桶文件 .

详情:

-   [请停止使用 Barrel 文件](https://tkdodo.eu/blog/please-stop-using-barrel-files)

### eslint 插件检查文件

[eslint 插件检查文件](https://github.com/dukeluo/eslint-plugin-check-file/)

强制执行 `KEBAB_CASE` 用于文件名和文件夹.

#### 为什么?

1.  **横向一致性**: 避免对案件不敏感系统(Windows, macOS)的问题,其中 `MyFile.js` 财务报告和审定财务报表 `myfile.js` 同等待遇
2.  **可读性**: 字与连字符的自然分离
3.  **可预测性**: 整个项目一致的文件命名模式

## 许可证

麻省理工学院

## 常见问题

### @caspeco/eslint-config-ts 是什么？

TypeScript 项目的 Caspeco ESLint 配置

### 如何安装 @caspeco/eslint-config-ts？

在项目目录运行 npm install @caspeco/eslint-config-ts，或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖：eslint（^9\.39\.4 \|\| ^10\.0\.0）、@eslint/js（^9\.39\.4 \|\| ^10\.0\.0）、typescript-eslint（^8\.57\.2）、eslint-config-prettier（^10\.1\.8）、eslint-plugin-check-file（^3\.3\.2）、eslint-plugin-baseline-js（^0\.7\.5）、eslint-plugin-no-barrel-files（^2\.2\.0）。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖，Yarn 需要手动安装。它还提供命令行工具 caspeco-ts-migrate-v5，可以用 npx caspeco-ts-migrate-v5 直接运行。

### @caspeco/eslint-config-ts 支持 TypeScript 吗？

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

### @caspeco/eslint-config-ts 支持 ESM 还是 CommonJS？

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

### @caspeco/eslint-config-ts 可以商用吗？

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

### @caspeco/eslint-config-ts 的下载量有多少？

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

### @caspeco/eslint-config-ts 还在维护吗？

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

