Tslint: Some error messages displayed seem irrelevant

Created on 19 Nov 2017  ·  3Comments  ·  Source: palantir/tslint

Bug Report

  • __TSLint version__: 5.8.0
  • __TypeScript version__: 2.6.1
  • __Running TSLint via__: CLI / Node.js API / VSCode

TypeScript code being linted

(function () {
    console.log('Hello World!');
})();

Actual behavior

without tslint.json configuration, it shows the error message:

> tslint test.ts

Could not find implementations for the following rules specified in the configuration:
    label-undefined
    no-duplicate-key
    no-trailing-comma
    no-unreachable
    use-strict
Try upgrading TSLint and/or ensuring that you have all necessary custom rules installed.
If TSLint was recently upgraded, you may have old rules configured which need to be cleaned up.

Warning: The 'no-unused-variable' rule requires type information.
Warning: The 'no-use-before-declare' rule requires type information.

ERROR: test.ts[1, 11]: expected call-signature to have a typedef
ERROR: test.ts[2, 17]: ' should be "

Why does it complains about not able to find implementations for the rules label-undefined, no-duplicate-key, no-trailing-comma, no-unreachable, use-strict specified in the configuration? As there are no custom rules defined, no extended rules as well, it should come from TSLint, but I searched through the TSLint package downloaded from npm, apart from they have been mentioned in CHANGELOG.md, nowhere else have been defined/referenced in TSLint source. So where do they come from?

But with below tslint.json configuration, it shows OK:

{
    "defaultSeverity": "error",
    "extends": [
        "tslint:recommended"
    ],
    "jsRules": {},
    "rules": {},
    "rulesDirectory": []
}

Expected behavior

without tslint.json configuration, it shouldn't complain about not able to find implementations for the those rules.

Not A Bug

Most helpful comment

You have an outdated tslint.json in a parent directory or your home directory.

All 3 comments

You have an outdated tslint.json in a parent directory or your home directory.

@ajafff Thanks, you r right. somehow in my user folder there is already a \Users\<MyUserName>\tslint.json before I installed TSLint this time. So close it.

Somehow I had something create a tslint.json in my home folder too and cause this problem. Would be nice if tslint had the option to not go fishing in user home directory. Or if the error message indicated where the listed rules came from. Thanks for the tip @ajafff! I was banging my head over this error.

Was this page helpful?
0 / 5 - 0 ratings