我正在配置SonarTsPlugin,并且正在尝试弄清楚要在我的tslint.json中放入什么(我还没有)。首先,我想启用SonarQube中所有可用的TypeScript规则。我找到了这个,并将其随机添加到我的项目中:
{
"jsRules": {
"class-name": true,
"comment-format": [
true,
"check-space"
],
"indent": [
true,
"spaces"
],
"no-duplicate-variable": true,
"no-eval": true,
"no-trailing-whitespace": true,
"no-unsafe-finally": true,
"one-line": [
true,
"check-open-brace",
"check-whitespace"
],
"quotemark": [
true,
"double"
],
"semicolon": [
true,
"always"
],
"triple-equals": [
true,
"allow-null-check"
],
"variable-name": [
true,
"ban-keywords"
],
"whitespace": [
true,
"check-branch",
"check-decl",
"check-operator",
"check-separator",
"check-type"
]
},
"rules": {
"class-name": true,
"comment-format": [
true,
"check-space"
],
"curly": true,
"indent": [
true,
"spaces"
],
"no-eval": true,
"no-internal-module": true,
"no-trailing-whitespace": true,
"no-unsafe-finally": true,
"no-var-keyword": true,
"one-line": [
true,
"check-open-brace",
"check-whitespace"
],
"quotemark": [
true,
"double"
],
"semicolon": [
true,
"always"
],
"triple-equals": [
true,
"allow-null-check"
],
"typedef-whitespace": [
true,
{
"call-signature": "nospace",
"index-signature": "nospace",
"parameter": "nospace",
"property-declaration": "nospace",
"variable-declaration": "nospace"
}
],
"variable-name": [
true,
"ban-keywords"
],
"whitespace": [
true,
"check-branch",
"check-decl",
"check-operator",
"check-separator",
"check-type"
]
}
}TypeScript插件可以很好地使用它,但我不确定它是否启用了所有可能的规则。有没有能做到这一点的tslint.json示例?谢谢。
注意:我启动了tsc --init命令来生成一个默认的配置文件,但是我问自己同样的问题。在SonarQube中,我看到有100+规则,但文件只包含~50。
发布于 2017-06-17 19:13:40
您可以找到TSLint in their official documentation支持的规则的完整列表
https://stackoverflow.com/questions/44603783
复制相似问题