How to ignore *.d.ts files when using tslint?

╄→尐↘猪︶ㄣ 提交于 2019-12-24 01:55:21

问题


I want to add tslint to my workflow. I installed it via:

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

And my tslint.json looks like:

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

Yet when I run:

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

it also checks a lot of definitely typed files, e.g.:

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

polluting the output.

I want to check only my *.ts files and am looking for a way to ignore the other types.

I saw that there was a --exclude option, yet it still shows the d.ts files when I run:

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

回答1:


The exclude option either requires a =, hence:

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

or wrapping the ignore part into quotes:

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

will work as expected.



来源:https://stackoverflow.com/questions/39572614/how-to-ignore-d-ts-files-when-using-tslint

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!