2017-02-28 87 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/**" 
    } 
    ]