2017-02-28 86 views
10

类似排除某些文件/目录形式掉毛到this question如何忽略/ - 在角度CLI

我运行下面的命令来掉毛我angular2打字稿代码。

ng lint 

它证明了所有的linting错误很好。

但我希望我的供应商文件夹(让说“src /应用程序/报价/服务/生成/ **/*”)不应包括在衬里时。

我知道这可以用tslint命令来完成如下(Reference Here

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

但在角CLI会是怎样的参数?如何从tslint中排除一些文件?

注:我的角度CLI版本是:@角/ CLI:1.0.0-rc.0

回答

10

根据角CLI issue#5063,你可以在样.angular-cli.json添加排除路径这样的:

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

想通它必须是一个blob模式..

如果需要多个文件/目录只是在你的.angular-cli.json

使用数组
0

你的角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/**" 
    } 
    ] 

您需要删除的“SRC/tsconfig.spec.json”皮棉路径。因此,删除第二个对象或对其进行注释。 您更新的皮棉阵列应该是这样的 -

"lint": [ 
    { 
     "project": "src/tsconfig.app.json", 
     "exclude": "**/node_modules/**" 
    },`enter code here` 
    { 
     "project": "e2e/tsconfig.e2e.json", 
     "exclude": "**/node_modules/**" 
    } 
    ]