2017-06-17 571 views
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。

回答

1

您可以找到TSLint支持的规则的完整列表in their official documentation

+0

好的,这很方便。因此,例如,从SonarQube配置生成tslint.json文件是不可能的?这太糟糕了,我觉得SonarQube中的TypeScript质量配置文件和项目中的自定义配置都有点麻烦。我想知道为什么这样实施。 –