Tslint: 显示的一些错误消息似乎无关紧要

创建于 2017-11-19  ·  3评论  ·  资料来源: palantir/tslint

错误报告

  • __TSLint 版本__:5.8.0
  • __打字稿版本__:2.6.1
  • __通过__运行TSLint:CLI / Node.js API / VSCode

正在整理 TypeScript 代码

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

实际行为

如果没有tslint.json配置,它会显示错误消息:

> 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 "

为什么它抱怨无法找到配置中指定的规则label-undefinedno-duplicate-keyno-trailing-commano-unreachableuse-strict的实现? 由于没有定义自定义规则,也没有扩展规则,它应该来自 TSLint,但我搜索了从 npm 下载的 TSLint 包,除了它们在CHANGELOG.md 中提到过

但是使用低于tslint.json配置,它显示 OK:

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

预期行为

如果没有tslint.json配置,它不应该抱怨无法找到这些规则的实现。

Not A Bug

最有用的评论

您在父目录或主目录中有一个过时的 tslint.json。

所有3条评论

您在父目录或主目录中有一个过时的 tslint.json。

@ajafff谢谢,你说得对。 不知何故,在我这次安装TSLint之前,我的用户文件夹中已经有一个\Users\<MyUserName>\tslint.json 。 所以关闭它。

不知何故,我也在我的主文件夹中创建了一个tslint.json并导致了这个问题。 如果 tslint 可以选择不在用户主目录中钓鱼,那就太好了。 或者,如果错误消息指示列出的规则来自何处。 感谢@ajafff​​ 的提示! 我对这个错误感到很头疼。

此页面是否有帮助?
0 / 5 - 0 等级

相关问题

CSchulz picture CSchulz  ·  3评论

denkomanceski picture denkomanceski  ·  3评论

zewa666 picture zewa666  ·  3评论

jacob-robertson picture jacob-robertson  ·  3评论

Ne-Ne picture Ne-Ne  ·  3评论