简体   繁体   English

如何在另一个项目的angular2中导入tslint.json文件?

[英]How to ingore tslint.json file in angular2 of another project?

I have an angular app which has another standalone angular app as a dependency. 我有一个角度应用程序,它具有另一个独立的角度应用程序作为依赖项。 Everything works fine apart from the linting. 除了棉绒外,一切都正常。

The problem is when I run ng lint in my terminal I get the following error: 问题是,当我在终端中运行ng lint时 ,出现以下错误:

Failed to load path.... node/modules/codelyzer. 无法加载路径。...节点/模块/代码解析器。

When I remove my tslint.json from the dependency project the error resolves immediately. 当我从依赖项项目中删除tslint.json时 ,该错误会立即解决。

The problem is here obviously that angular sees two tslint.json , one from my main app and the other from the dependency project which is now part of the main app. 这里的问题显然是angular看到了两个tslint.json ,一个来自我的主应用程序,另一个来自依赖项项目,该项目现在是主应用程序的一部分。

How can I solve this problem without manually deleting the tslint.json from the dependency project? 如何在从依赖项项目中手动删除tslint.json的情况下解决此问题? I would like to keep it there. 我想保留在那里。

I was thinking about excluding it in the angular.cli.json lint field, but wasn't successful. 我当时正在考虑在angular.cli.json lint字段中排除它,但没有成功。 Also put an exclude in the tslint.json but didn't get positive results 也将排除项放在tslint.json中,但没有得到积极的结果

I've found the problem, I've excluded tslint.json from my main app in the angular.cli.json by writing the following: 我发现了问题,我通过编写以下代码从Angular.cli.json中的主应用程序中排除了tslint.json:

"lint": [
  {
  "project": "path/tslint.json",
  "exclude": "path/node_modules/my_project"
  }
]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM