typescript-eslint @typescript-eslint/eslint-plugin @typescript-eslint/parser 区别
时间: 2025-01-24 16:08:15 浏览: 140
### 解析 TypeScript ESLint 生态系统中的组件
#### @typescript-eslint/parser
`@typescript-eslint/parser` 是一个自定义的 ESLint 解析器,用于解析 TypeScript 文件。ESLint 默认不支持 TypeScript 的语法特性,因此需要这个特定的解析器来处理 `.ts` 或者 `.tsx` 文件的内容[^2]。
```json
{
"parser": "@typescript-eslint/parser"
}
```
#### @typescript-eslint/eslint-plugin
`@typescript-eslint/eslint-plugin` 提供了一组额外的规则和插件功能,专门针对 TypeScript 编程语言设计。这些规则可以补充标准 JavaScript 规则集,并提供更严格的类型检查和其他有用的编码实践建议。
```json
{
"plugins": ["@typescript-eslint"],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended"
]
}
```
#### typescript-eslint
`typescript-eslint` 实际上是一个伞形包 (umbrella package),它包含了上述两个主要工具以及其他辅助资源。通过安装 `eslint-config-standard-with-typescript` 可以简化配置过程并引入推荐的最佳实践设置[^1]。
阅读全文
相关推荐


















