插件之:TSLINT
概述
现在开发后端主要的开发语言是Typescript,检查工具使用的是tslint。由于存在一些问题,tslint被弃用了,建议使用eslint。但是实际使用eslint的过程中,发现达不到之前使用tslint的效果。所有没有办法,还是一直使用tslint,但是每次需要手动开启。
直到有一天,我再次安装插件的时候,发现了tslint有一个是新版本。全称是:ms-vscode.vscode-typescript-tslint-plugin,版本是1.3.3,是microsoft的官方版本插件。 这表示了众多使用tslint者的愿意。
❗IMPORTANT: TSLint has been deprecated in favor of ESLint.
Please look into migrating your projects to ESLint.
Adds tslint to VS Code using the TypeScript TSLint language service plugin.
Please refer to the tslint documentation for how to configure the linting rules.
新tslint的插件使用
在Vscode的插件管理,搜索tslint
这个时候,会看到microsoft出品的tslint, 版本是1.3.3
安装并启用
和原来tslint配置一样,在工程的根目录创建tslint.json,我这里默认配置如下:
{
"defaultSeverity" : "error" ,
"extends" : [
"tslint:recommended"
] ,
"jsRules" : {
} ,
"rules" : {
"no-namespace" : false ,
"ordered-imports" : false ,
"member-ordering" : false ,
"object-literal-sort-keys" : false ,
"trailing-comma" : false ,
"no-var-requires" : false ,
"no-empty" : false ,
"interface-over-type-literal" : false ,
"object-literal-shorthand" : false ,
"no-empty-interface" : false ,
"interface-name" : false ,
"eofline" : false ,
"variable-name" : false ,
"max-classes-per-file" : false ,
"quotemark" : false