问题描述
我们可以通过这种方式排除node_modules.
We can exclude node_modules in this way.
"lint": [
{
"project": "src/main/webapp/app/file.json",
"exclude": "**/node_modules/**"
}
]
但是如何排除目录下的所有文件?
But how to exclude all files under a directory?
我尝试了以下方式.它不起作用
I tried below way. It is not working
"exclude": [
"**/*whatever.pipe.ts",
"**/*whatever_else.component.ts"
]
这是目录"src/main/assets/js/ngx-typeahead"
我必须排除该目录下的所有文件.
I have to exclude all the files under this directory from linting.
我该如何实现?
任何建议将不胜感激.
推荐答案
您可以通过修改 tsconfig.json
中的 lint
行来做到这一点:
You can do that by modifying your lint
line inside tsconfig.json
:
"lint": [
{
"exclude": [
"src/main/assets/js/ngx-typeahead/**/*.ts",
]
}
]
此 PATH/**/*.ts
表示此路径下的所有文件以及扩展名为 .ts
This PATH/**/*.ts
means all files under this path and any subdirectory inside with the extension .ts
我相信"src/main/assets/js/ngx-typeahead/*
将排除此路径下的所有文件
And I believe "src/main/assets/js/ngx-typeahead/*
will exclude all files under this path
另一种选择是使用 tslint.json
:
{
"extends": "tslint:recommended",
......
"linterOptions": {
"exclude": [
"src/main/assets/js/ngx-typeahead/**/*.ts",
]
}
}
更多信息: https://palantir.github.io/tslint/usage/configuration/
修改2:通过提供以下内容,我发现了此问题链接,用于特定角度的棉绒您究竟想不脱绒毛而不是用剔毛使项目脱毛的原因是什么!
Edit 2:I found this issue link for angular-cli specific linting, by providing what exactly you want to lint instead of linting the project with excludes!
内部 .angular-cli.json
中提供 lint
选项:
"lint": [{
"files": "src/**/*.ts",
"project": "src/tsconfig.app.json"
},
{
"files": "src/**/*.ts",
"project": "src/tsconfig.spec.json"
},
{
"files": "src/**/*.ts",
"project": "e2e/tsconfig.e2e.json"
}
]
这篇关于如何使用angular CLI在lint中排除目录下的所有文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!