获取tslint.json文件中的所有TsLint规则

时间:2017-06-17 10:58:00

标签: typescript sonarqube tslint

我正在配置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。

1 个答案:

答案 0 :(得分:1)

您可以找到TSLint in their official documentation

支持的完整规则列表