Ram*_*a S 3 lint angular-cli angular
我们可以通过这种方式排除 node_modules。
"lint": [
{
"project": "src/main/webapp/app/file.json",
"exclude": "**/node_modules/**"
}
]
Run Code Online (Sandbox Code Playgroud)
但是如何排除一个目录下的所有文件呢?
我试过下面的方法。它不工作
"exclude": [
"**/*whatever.pipe.ts",
"**/*whatever_else.component.ts"
]
Run Code Online (Sandbox Code Playgroud)
所以这是我当前的目录路径 "src/main/assets/js/ngx-typeahead"
我必须从 linting 中排除此目录下的所有文件。
我怎样才能做到这一点?
任何建议,将不胜感激。
您可以通过修改lint里面的行来做到这一点tsconfig.json:
"lint": [
{
"exclude": [
"src/main/assets/js/ngx-typeahead/**/*.ts",
]
}
]
Run Code Online (Sandbox Code Playgroud)
这PATH/**/*.ts意味着此路径下的所有文件以及带有扩展名的任何子目录.ts
我相信"src/main/assets/js/ngx-typeahead/*会排除此路径下的所有文件
编辑:
另一种选择是使用tslint.json:
{
"extends": "tslint:recommended",
......
"linterOptions": {
"exclude": [
"src/main/assets/js/ngx-typeahead/**/*.ts",
]
}
}
Run Code Online (Sandbox Code Playgroud)
更多信息:https : //palantir.github.io/tslint/usage/configuration/
编辑 2: 我找到了这个问题链接,用于特定于 angular-cli 的 linting,通过提供您想要 lint 的确切内容而不是使用 excludes 对项目进行 linting!
里面.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"
}
]
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7368 次 |
| 最近记录: |