Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit dfcc1da

Browse files
committed
更新流程图
1 parent 0ea5280 commit dfcc1da

File tree

3 files changed

+2
-18
lines changed

3 files changed

+2
-18
lines changed

assets/eslint-or-tslint-process.png

116 KB
Loading

assets/graphs.pptx

43.1 KB
Binary file not shown.

engineering/lint.md

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ console.log(`My name is ${myName}`)
8181

8282
## 应该使用哪种代码检查工具
8383

84-
TSLint 与 ESLint 作为检查 TypeScript 代码的工具,各自都有自己的优点
84+
TSLint 与 ESLint 作为检查 TypeScript 代码的工具,各自有各自的优点
8585

8686
TSLint 的优点:
8787

@@ -127,23 +127,7 @@ ESLint 可以检测出来以上代码的函数参数超过了 7 个(需要开
127127

128128
那么到底该使用哪种代码检测工具呢?经过一些实践,我建议可以按照以下流程决定:
129129

130-
```ts
131-
if ('项目正在由 js 改造为 ts 的过程中') {
132-
if ('原 js 项目使用了 eslint') {
133-
if ('将会长时间处于 js 与 ts 共存的状态') {
134-
// 由于一个项目中无法针对不同后缀的文件使用不同的 eslint 配置
135-
// 故新 ts 文件只能使用 tslint 检查,老 js 文件保持使用 eslint 检查
136-
return 'tslint' & 'eslint';
137-
} else if ('能够快速的将所有文件都重构为 ts') {
138-
// 使原有 eslint 支持对 ts 文件的检查
139-
return 'eslint';
140-
}
141-
}
142-
}
143-
// TSLint 利用类型系统增强的一些检查大多是无关痛痒的,或者是可以在 tsc 编译过程中检查出来的
144-
// ESLint 生态环境更好,虽然现在还存在一些 bug,但是应该积极使用,推动它的发展
145-
return 'eslint';
146-
```
130+
![流程图:选择 ESLint 还是 TSLint](../assets/eslint-or-tslint-process.png)
147131

148132
## 在 TypeScript 中使用 ESLint
149133

0 commit comments

Comments
 (0)