使用 tslint 时如何忽略 *.d.ts 文件? [英] How to ignore *.d.ts files when using tslint?

查看:120
本文介绍了使用 tslint 时如何忽略 *.d.ts 文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将 tslint 添加到我的工作流程中.我通过以下方式安装它:

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

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

我的 tslint.json 看起来像:

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

然而当我跑步时:

./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

污染输出.

我只想检查我的 *.ts 文件,并且正在寻找一种忽略其他类型的方法.

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

我看到有一个 --exclude 选项,但是当我运行时它仍然显示 d.ts 文件:

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

推荐答案

排除选项需要 =,因此:

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"

将按预期工作.

这篇关于使用 tslint 时如何忽略 *.d.ts 文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆