Angular 如何在cli中忽略/排除某些文件/目录
近似 我正在运行下面的命令来linting我的angular2 typeScript代码Angular 如何在cli中忽略/排除某些文件/目录,angular,angular-cli,tslint,Angular,Angular Cli,Tslint,近似 我正在运行下面的命令来linting我的angular2 typeScript代码 ng lint 它很好地证明了所有的脱毛错误 但我希望我的供应商文件夹(比如“src/app/quote/services/generated/***”)在发布时不包括在内 我知道这可以用tslint命令完成,如下() 但在这个例子中,参数是什么?如何从tslint中排除某些文件 注意:我的Angular Cli版本是:@Angular/Cli:1.0.0-rc.0来自Angular6+,.Angular
ng lint
它很好地证明了所有的脱毛错误
但我希望我的供应商文件夹(比如“src/app/quote/services/generated/***”)在发布时不包括在内
我知道这可以用tslint命令完成,如下()
但在这个例子中,参数是什么?如何从tslint中排除某些文件
注意:我的Angular Cli版本是:@Angular/Cli:1.0.0-rc.0来自Angular6+,
.Angular Cli.json
已替换为Angular.json
,但您仍然可以在其lint
部分添加排除路径
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"src/tsconfig.app.json",
"src/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**" // excluded directories
]
}
}
根据angular cli,您可以在
.angular cli.json
中添加排除路径,如下所示:
"lint": [
{
"project": "src/tsconfig.app.json",
"exclude": "**/node_modules/**/*" // the node_modules for example
}]
我发现它一定是一个斑点图案 如果需要多个文件/目录,只需在
.angular cli.json
"exclude": [
"**/*whatever.pipe.ts",
"**/*whatever_else.component.ts"
]
您的angular-cli.json文件如下-
"lint": [
{
"project": "src/tsconfig.app.json",
"exclude": "**/node_modules/**"
},
{
"project": "src/tsconfig.spec.json",
"exclude": "**/node_modules/**"
},
{
"project": "e2e/tsconfig.e2e.json",
"exclude": "**/node_modules/**"
}
]
"lint": [
{
"project": "src/tsconfig.app.json",
"exclude": "**/node_modules/**"
},
{
"project": "e2e/tsconfig.e2e.json",
"exclude": "**/node_modules/**"
}
]
您需要删除“src/tsconfig.spec.json”的lint路径。因此,要么删除第二个对象,要么对其进行注释。
更新后的lint数组应该如下所示-
"lint": [
{
"project": "src/tsconfig.app.json",
"exclude": "**/node_modules/**"
},
{
"project": "src/tsconfig.spec.json",
"exclude": "**/node_modules/**"
},
{
"project": "e2e/tsconfig.e2e.json",
"exclude": "**/node_modules/**"
}
]
"lint": [
{
"project": "src/tsconfig.app.json",
"exclude": "**/node_modules/**"
},
{
"project": "e2e/tsconfig.e2e.json",
"exclude": "**/node_modules/**"
}
]
实际上,我发现解决方案是编辑
/src/app/tsconfig.app.json
下的exclude
属性,而不是.angular cli.json
。实际上,我发现解决方案是编辑/src/tsconfig.app.json
下的exclude
属性,而不是.angular cli.json
。