# @deslop/coding-standards 中文文档

规范地址：https://npmcn.com/package/%40deslop/coding-standards/

版本：0\.1\.1214
npm 元数据更新时间：2026-10-31T22:20:11.642Z
中文译文更新时间：2026-10-31T23:09:13.336Z
软件包许可：未声明

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

原始 npm 页面：https://www.npmjs.com/package/%40deslop/coding-standards
原文对照：https://npmcn.com/package/%40deslop/coding-standards/?lang=original
项目主页：https://github.com/MP281X/deslop#readme
源码仓库：https://github.com/MP281X/deslop

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

- 包体积（解压后）：1.3 MB，12 个文件
- 模块格式：ES Module
- TypeScript 类型：未声明
- 运行依赖：5 个
- peer 依赖：vite-plus ^1\.3
- 首次发布：2026-10-03T14:58:54.311Z
- 最新版本发布：2026-10-31T22:20:11.245Z
- 已发布版本数：129（近 12 个月 129 个）

## 中文简介

仅语法的Vite+ lint预设，具有Effect诊断的严格编译器配置，以及Claude Code和Codex的三个技能： `lint-companion`， `pull-requests` 和 `review`． 在已发布的版本上安装 `writing-code` 直接离开

## 安装

```sh
npm install @deslop/coding-standards
```

也可以使用：`pnpm add @deslop/coding-standards`、`yarn add @deslop/coding-standards`、`bun add @deslop/coding-standards`

## README

# @deslop /编码标准

仅语法的Vite+ lint预设，具有Effect诊断的严格编译器配置，以及Claude Code和Codex的三个技能： `lint-companion`， `pull-requests` 和 `review`． 在已发布的版本上安装 `writing-code` 留下那个目录；删除它。

Vite+拥有语法检查和插件编写api；效果补丁tsrs拥有编译器诊断。

```bash
vpx @deslop/coding-standards@latest
vp add -D @deslop/coding-standards@latest @effect/tsgo@latest tsrs@latest
```

```ts
import {defineConfig} from 'vite-plus'

import {lint} from '@deslop/coding-standards'

export default defineConfig({lint: {extends: [lint]}})
```

```jsonc
// package.json
{
    "scripts": {
        "prepare": "effect-tsgo patch --no-typescript --tsrs",
        "typecheck": "tsrs --noEmit --checkerAssignment go",
        "check": "vp check && vp run typecheck"
    }
}
```

```jsonc
// tsconfig.json
{"extends": "@deslop/coding-standards/tsconfig.json"}
```

-   **项目设置** 去旁边 `extends`;预设不忽略任何内容，所以添加 `**/*.gen.ts` 对你自己的忽视。
-   **本地规则** 根据名称，每个类别都被取消：工具升级没有选择。删除规则来自本地插件注册表，没有第二个名称列表。本土规则拥有它们所能表达的东西；自定义规则涵盖了剩余的Effect和React契约。
-   **语法。** `typescript` 插件规则，例如 `no-explicit-any`， `consistent-type-imports` 和 `method-signature-style` 不需要类型信息； `typeAware: false` 禁用推断类型规则，例如 `no-floating-promises`； `typeCheck: false` 将编译器错误留给特效补丁 `tsrs` 检查。

## 收集的性能

`no-accumulating-copy` 检查内联效果 `Array.reduce`/`reduceRight` 回调，包括嵌套回调中捕获的累加器读取：

```diff
-Array.reduce(items, [], (all, item) => [...all, transform(item)])
+Array.map(items, transform)
```

-   **也标志** 效果数组追加/前置， `Record.set` 计算机键记录传播开来。
-   **而不是**： `Array.mapAccum` 对于状态选择； `MutableList`/`MutableHashMap` 适合当地收藏家。
-   **有效的**：标量折叠，持久化 `HashMap.set`，非计算对象属性更新。
-   **有意的** 快照、有界窗口或有界键集采用合理的内联禁用；这条规则没有推断出增长，也没有改写任何内容。
-   **`Array.contains`** 结构;用于身份识别 `Array.containsWith(Equivalence.strictEqual())`，因为只有语法的预设不能推断出预期的相等性。

## 常见问题

### @deslop/coding-standards 是什么？

仅语法的Vite\+ lint预设，具有Effect诊断的严格编译器配置，以及Claude Code和Codex的三个技能： lint-companion， pull-requests 和 review． 在已发布的版本上安装 writing-code 直接离开

### 如何安装 @deslop/coding-standards？

在项目目录运行 npm install @deslop/coding-standards，或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖：vite-plus（^1\.3）。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖，Yarn 需要手动安装。它还提供命令行工具 deslop-coding-standards，可以用 npx deslop-coding-standards 直接运行。

### @deslop/coding-standards 支持 TypeScript 吗？

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

### @deslop/coding-standards 支持 ESM 还是 CommonJS？

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

### @deslop/coding-standards 可以商用吗？

@deslop/coding-standards 使用 未声明 许可。package\.json 没有声明许可证。没有许可证的代码默认保留全部权利，商用前请联系作者或查看仓库中的 LICENSE 文件。以上为概括，不构成法律意见，请以许可原文为准。

### @deslop/coding-standards 还在维护吗？

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

