Tslint: Overwriting rule options does not work

Created on 20 Jul 2017  ·  3Comments  ·  Source: palantir/tslint

Bug Report

  • __TSLint version__: 5.4.3
  • __TypeScript version__: 2.3.4
  • __Running TSLint via__: CLI

TypeScript code being linted

console.log()

with tslint.json configuration:

{
  "extends": "tslint-microsoft-contrib",
  "rules": {
    "no-console": {
      "options": [
        "time",
        "timeEnd"
      ]
    }
  }
}

tslint-microsoft-contrib:

    "no-console": [
      true,
      "debug",
      "info",
      "log",
      "time",
      "timeEnd",
      "trace"
    ],

Actual behavior

Does not fail for console.log.

Expected behavior

Should fail.

Not A Bug

Most helpful comment

@CSchulz #924 already contains some thoughts on this topic. This discussion should continue over there.

All 3 comments

The options for this rule are a blacklist, not a whitelist.
If you don't specify any banned methods, all are banned by default. If you specify options, only those methods are banned.

We should definitely add the ability to whitelist certain methods instead of blacklisting all other methods. But that's out of scope for this issue.

I would like to implement it as whitelist, but I don't see any good way to implement it without breaking changes.

Do you have any hint for me?

@CSchulz #924 already contains some thoughts on this topic. This discussion should continue over there.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

cerebrl picture cerebrl  ·  20Comments

zdychacek picture zdychacek  ·  33Comments

andy-ms picture andy-ms  ·  18Comments

gclifford picture gclifford  ·  43Comments

adidahiya picture adidahiya  ·  37Comments