1
votes

I have the following TSLint (same as ESLint) rule:

"rules": {
        "prefer-const": false,
        "no-trailing-whitespace": false,
        "one-line": [
            true,
            "check-catch",
            "check-finally",
            "check-open-brace",
            "check-whitespace"
        ],

I'm trying to set the severity of the one-line rule to warning, but the array of checks does not seem to accept "severity": "warn"

What's the syntax to achieve this? I have found examples of using severity:warn, but not with an array of checks

UPDATE I'm finding the constant error warnings so distracting - especially as they appear immediately as you type - let somVar = gives error: prefer-const until I actually finish typing and do a reassign:-) VSCode - "tslint.alwaysShowRuleFailuresAsWarnings": true, will do for now!! The green squiggle is barely noticable, and Auto Fixing also kicks in on save

1

1 Answers

2
votes

To specify the severity, you can configure the one-line rule like this:

{
    "rules": {
        "one-line": {
            "options": [
                "check-catch",
                "check-finally",
                "check-open-brace",
                "check-whitespace"
            ],
            "severity": "warning"
        }
    }
}

For more information, consult the tslint.json documentation.