# @inthedark/dxlint 中文文档

规范地址：https://npmcn.com/package/%40inthedark/dxlint/

版本：0\.1\.12
npm 元数据更新时间：2026-11-01T11:15:56.293Z
中文译文更新时间：2026-11-01T11:41:57.532Z
软件包许可：MIT

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

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

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

- 包体积（解压后）：30.1 MB，185 个文件
- TypeScript 类型：未声明
- Node.js 要求：\>=18
- 运行依赖：0 个
- 首次发布：2026-10-25T13:21:59.391Z
- 最新版本发布：2026-11-01T11:15:55.926Z
- 已发布版本数：14（近 12 个月 14 个）

## 中文简介

让你和你的经纪人拥有你的衣料

## 安装

```sh
npm install @inthedark/dxlint
```

也可以使用：`pnpm add @inthedark/dxlint`、`yarn add @inthedark/dxlint`、`bun add @inthedark/dxlint`

## README

# dxlint

让你和你的经纪人拥有你的衣料

```dx
import .ts
import rules:recommended

rule es-eqeqeq error
rule es-no-floating-promises
```

```
$ dxlint
warn: Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator. [no-floating-promises]
  --> src/save.ts:4:3
  |
4 |   writeFile(path, data);
  |   ^^^^^^^^^^^^^^^^^^^^^^
```

## 另一个短绒吗?啊…

-   **它比eslint+typescript-eslint快200倍。** 因为苹果对苹果需要eslint _没有_ 它启用了缓存，dxlint的缓存是固有的。（即使没有这个，它的速度也是原来的两倍，而且对内存的消耗也大大减少。）
-   **它有几乎完美的eslint奇偶性。** 99.4%的eslint和typescript-eslint的测试用例给出了相同的结果。类型感知规则读取您的 `tsconfig.json` _不运行typescript_
-   **一切都是不可战胜的，你拥有一切。** 内置规则包括 `.dx` 文件：覆盖它们，调整它们，编写自己的文件，或者描述一种全新的语言
-   **再加上一个高质量的vscode扩展！** 非常快，有诊断，有适当的 `.dx` 太阳能发电

## 开始

```sh
npm install --save-dev @inthedark/dxlint
```

放一个 `.dx` 在你的项目根目录：

```dx
import .ts
import rules:recommended

ignore "dist" "src/generated/**"
```

| 命令 |  |
| --- | --- |
| `dxlint [paths]` | 检查项目（方面） `.gitignore`） |
| `dxlint --fix` | 应用补丁 |
| `dxlint rules` | 列出每个规则及其选项 |
| `dxlint describe <name>` | 解释配置中的规则、选项或其他内容 |

退出代码1表示发现错误，2表示配置被破坏。 

别忘了加 `.dxcache` 来 `.gitignore`!!！

要了解更多基础知识： [文档/ basic.md](https://npmcn.com/package/%40inthedark/dxlint/docs/basic.md) 和 [规则列表](https://npmcn.com/package/%40inthedark/dxlint/docs/rules/README.md).

## 的语言

规则就是几行 `.dx`：在哪里看，什么时候是错误的，以及可选的修复

```dx
import .ts

in ts_call.callee rule no-alert-calls error "use the notification service instead of {text}" {
  when text == "alert"
}
```

[文档/ advanced.md](https://npmcn.com/package/%40inthedark/dxlint/docs/advanced.md) 涵盖整个语言，从内置语法树的规则到定义自己的语言。 [文档/ ts.md](https://npmcn.com/package/%40inthedark/dxlint/docs/ts.md) 涵盖了TypeScript库所理解的内容：作用域、模块、类型和窄化。

## 表演

一芯(`--jobs 1`（两人都被钉在同一个岩心上，用一次时间测量），项目共有2,094人。Ts文件，其复杂的自定义eslint配置移植，类型感知规则包括：

|  | ESLint | dxlint |
| --- | --- | --- |
| 第一次运行 | 164年代 | 72年代 |
| 缓存运行，没有改变 | 4.4秒 | 0.8秒 |
| 峰值内存（工作集） | 2.0 GB | 0.7 GB |

记住：这不是一个公平的比较，因为 [Eslint——cache对typescript-eslint不起作用](https://typescript-eslint.io/troubleshooting/faqs/eslint/?utm_source=chatgpt.com#can-i-use-eslints---cache-with-typescript-eslint)！ 

还要注意的是，默认情况下，dxlint使用每个核心，并且由于不依赖于typescript本身，它比eslint+typescript-eslint要好得多

## 常见问题

### @inthedark/dxlint 是什么？

让你和你的经纪人拥有你的衣料

### 如何安装 @inthedark/dxlint？

在项目目录运行 npm install @inthedark/dxlint，或使用 pnpm add / yarn add / bun add。它还提供命令行工具 dxlint，可以用 npx dxlint 直接运行。

### @inthedark/dxlint 支持 TypeScript 吗？

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

### @inthedark/dxlint 需要什么版本的 Node\.js？

package\.json 的 engines 字段要求 Node\.js \>=18。版本不符时 npm 默认只给出警告，开启 engine-strict 后会拒绝安装。

### @inthedark/dxlint 可以商用吗？

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

### @inthedark/dxlint 还在维护吗？

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

