Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

Overwriting rule options does not work #3059

Closed
CSchulz opened this issue Jul 20, 2017 · 3 comments
Closed

Overwriting rule options does not work #3059

CSchulz opened this issue Jul 20, 2017 · 3 comments

Comments

@CSchulz
Copy link
Contributor

CSchulz commented Jul 20, 2017

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.

@ajafff
Copy link
Contributor

ajafff commented Jul 21, 2017

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.

@CSchulz
Copy link
Contributor Author

CSchulz commented Aug 22, 2017

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?

@ajafff
Copy link
Contributor

ajafff commented Aug 22, 2017

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants