Eri*_*ton 5 tslint visual-studio-code
我在Visual Studio Code中使用TSLint(通过TSLint扩展),它非常适合.ts
文件.它也运行在.js
文件上,这很好,但它不使用相同的规则,这对我来说很糟糕(对我而言).我怎样才能使用相同的规则?
我tslint.json
看起来像这样:
{
"extends": "tslint:latest",
"rules": {
"indent": [true, "tabs"],
// a bunch of others
}
}
Run Code Online (Sandbox Code Playgroud)
例如,我在.js
文件中收到此警告:
[tslint] space indentation expected (indent)
Run Code Online (Sandbox Code Playgroud)
(当我的规则设置好时,它希望我使用空格缩进"tabs"
.)
您可以指定要通过对JS文件,运行哪些规则jsRules
在你的财产tslint.json
的文件.例如:
{
"extends": "tslint:latest",
"rules": {
"indent": [true, "tabs"],
// a bunch of others
},
"jsRules": {
"indent": [true, "tabs"],
// a bunch more rules
}
}
Run Code Online (Sandbox Code Playgroud)
如果您正在扩展tslint:latest
,这些是截至撰写本文时的默认规则,您将禁用或覆盖您不想要的规则.
归档时间: |
|
查看次数: |
2175 次 |
最近记录: |