0
我配置SonarTsPlugin,我試圖找出要放什麼東西在我的tslint.json(我沒有一個至今)。首先,我想啓用SonarQube中的所有TypeScript規則。我發現這一個,它隨機添加到我的項目:獲取所有TsLint規則tslint.json文件
{
"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"
]
}
}
打字稿插件用它工作得很好,但我不知道它使所有可能的規則。有沒有人有一個tslint.json的例子呢?謝謝。
注:我公司推出的tsc --init
命令生成默認的配置文件,但我問自己同樣的問題。在SonarQube中,我看到有100多個規則,但文件只包含〜50。
好的,這很方便。因此,例如,從SonarQube配置生成tslint.json文件是不可能的?這太糟糕了,我覺得SonarQube中的TypeScript質量配置文件和項目中的自定義配置都有點麻煩。我想知道爲什麼這樣實施。 –