2016-09-19 36 views
1

我想將tslint添加到我的工作流程中。我通過安裝了它:如何在使用tslint時忽略* .d.ts文件?

npm install tslint tslint-config-ms-recommended --save-dev 

而且我tslint.json樣子:

{ 
    "extends": "tslint-config-ms-recommended" 
} 

然而,當我運行:

./node_modules/.bin/tslint src/**/*.ts 

它也檢查了很多的肯定類型的文件,如:

src/interfaces/highland.d.ts[621, 1]: space indentation expected 
src/interfaces/highland.d.ts[622, 1]: space indentation expected 
src/interfaces/highland.d.ts[635, 1]: space indentation expected 

污染輸出。

我想只檢查我的*.ts文件,並正在尋找一種方法來忽略其他類型。

我看到有一個--exclude選項,但它仍然顯示d.ts文件當我運行:

./node_modules/.bin/tslint src/**/*.ts --exclude src/**/*.d.ts 
+0

http://stackoverflow.com/questions/34578677/how-to-ignore-a-particular-directory-or-file-for-tslint – k0pernikus

回答

5

排除選項要麼需要=,因此:

tslint src/**/*.ts --exclude=src/**/*.d.ts 

或將忽略部分包裹在引號中:

tslint src/**/*.ts --exclude "src/**/*.d.ts" 

將作爲預期反恐執行局。

+0

另一種選擇是使用下面的正則表達式:'src/**/* [^ d $]。ts' – fxlemire

相關問題