【发布时间】:2019-07-30 20:21:02
【问题描述】:
我有一个新的工作区用于我正在维护的库。我们有 2 个在 Angular 5 中使用的自定义 TSLint 规则,它们没有利用 Angular CLI。我们现在正在迁移到 Angular CLI 和 Angular 7。
我们需要做的一件事是在 TSLint 获取它们之前不需要将这些 TSLint 规则编译为 JS。但是,这需要在我们的 package.json 的 lint 脚本中使用 ts-node。
我如何告诉ng 获取这些 TypeScript TSLint 规则文件?
tsconfig.json(在projects/my-lib/src)
{
"rulesDirectory": "./lib/tslint-rules"
}
然后,在我们的主工作区中,我们从库中扩展这个 tsconfig 并添加我们的自定义规则。
Could not find implementations for the following rules specified in the configuration:
my-custom-tslint-rule
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.
【问题讨论】:
-
查看这篇文章blog.rangle.io/custom-tslint-for-angular。根据他们的说法,这取决于 tslint 版本,是否需要将规则编译为 JS。不应该与使用
angular-cli或不相关 -
讽刺的是,那是我的博文。在这种情况下,我最终使用
ts-node来运行 linter。现在,如果可能的话,我想使用ng来运行限制
标签: angular typescript angular-cli tslint