dxlint
让你和你的经纪人拥有你的衣料
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太阳能发电
开始
npm install --save-dev @inthedark/dxlint
放一个 .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 和 规则列表.
的语言
规则就是几行 .dx:在哪里看,什么时候是错误的,以及可选的修复
import .ts
in ts_call.callee rule no-alert-calls error "use the notification service instead of {text}" {
when text == "alert"
}
文档/ advanced.md 涵盖整个语言,从内置语法树的规则到定义自己的语言。 文档/ 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不起作用!
还要注意的是,默认情况下,dxlint使用每个核心,并且由于不依赖于typescript本身,它比eslint+typescript-eslint要好得多