如何在Angular CLI中忽略/排除某些文件/目录

编程入门 行业动态 更新时间:2024-10-25 06:24:50
本文介绍了如何在Angular CLI中忽略/排除某些文件/目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

类似于此问题

我正在运行以下命令来整理我的angular2 typeScript代码.

I am running the following command to linting my angular2 typeScript code.

ng lint

它很好地证明了所有的掉毛错误.

It is proving all the linting error nicely.

但是我希望我的供应商文件夹(例如说"src/app/quote/services/generated/**/*")不包括在内.

But I want my vendor folder (let say "src/app/quote/services/generated/**/*") should not get included at the time of lining.

我知道可以使用tslint命令来完成此操作,如下所示(参考此处)

I know this can be done with tslint command as follows (Reference Here)

tslint \"src/**/*.ts\" -e \"**/__test__/**\"

但是在角度cli中,参数是什么?如何从tslint中排除某些文件?

But in angular cli what will be the parameter? How to exclude some files from tslint?

注意:我的Angular Cli版本是:@ angular/cli:1.0.0-rc.0

Note: My Angular Cli version is : @angular/cli: 1.0.0-rc.0

推荐答案

在 Angular6 + 中,.angular-cli.json已替换为angular.json,但是您仍然可以在其部分.

From Angular6+, .angular-cli.json has been replaced by angular.json, but you can still add the exclude path in its lint part.

"lint": { "builder": "@angular-devkit/build-angular:tslint", "options": { "tsConfig": [ "src/tsconfig.app.json", "src/tsconfig.spec.json" ], "exclude": [ "**/node_modules/**" // excluded directories ] } }

根据angular-cli issue#5063 ,您可以添加排除 .angular-cli.json 中的路径,如下所示:

According to the angular-cli issue#5063, you can add the exclude path in .angular-cli.json like this:

"lint": [ { "project": "src/tsconfig.app.json", "exclude": "**/node_modules/**/*" // the node_modules for example }]

更多推荐

如何在Angular CLI中忽略/排除某些文件/目录

本文发布于:2023-11-02 08:29:51,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1551898.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:文件   目录   如何在   CLI   Angular

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!