简体   繁体   English

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

[英]Get all TsLint rules in tslint.json file

I'm configuring the SonarTsPlugin and I'm trying to figure out what to put in my tslint.json (I don't have one yet). 我正在配置SonarTsPlugin,并试图找出要放入tslint.json的内容(我还没有)。 To begin, I would like to enable all TypeScript rules available in SonarQube. 首先,我想启用SonarQube中所有可用的TypeScript规则。 I've found this one and randomly added it to my project: 我找到了这个并将其随机添加到我的项目中:

{
    "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"
        ]
    }
}

The TypeScript plugin works well with it, but I'm not sure it enables all possible rules. TypeScript插件可以很好地工作,但是我不确定它是否支持所有可能的规则。 Does anyone have a tslint.json example which does it? 有人有tslint.json示例吗? Thank you. 谢谢。

Note: I launched the tsc --init command to generate a default config file, but I ask myself the same question. 注意:我启动了tsc --init命令以生成默认配置文件,但是我问自己同样的问题。 In SonarQube I see there are 100+ rules but the file only contains ~50. 在SonarQube中,我看到有100多个规则,但文件仅包含〜50个。

您可以在其官方文档中找到TSLint支持的规则的完整列表。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM