在Visual Studio 2015/2017中使用TSLint吗?

问题描述:

我的组织大量使用 TSLint 来质量检查我们的Typescript代码,它提供了有价值的信息为我们服务!但是,我们使用Visual Studio 2015& 2017年是我们的主要IDE,也是获得毛发结果的唯一方法,它可以运行gulp/grunt任务,该任务会将输出打印到Task Runner Explorer控制台.它可以工作,但是速度慢,而不是最佳的开发经验.

My organization uses TSLint pretty heavily for quality-checking our Typescript code, and it provides a valuable service to us! However, we use Visual Studio 2015 & 2017 as our main IDE and the only way to get the linting results it to run a gulp/grunt task which prints the output to the Task Runner Explorer console. It works, but it's slow and not the best development experience.

在我自己的较小项目中,我使用了VSCode,它具有一个很棒的TSLint插件突出显示棉绒违规行为,并提供对某些TSLint规则所具有的自动修复程序的访问权限.像这样:

In smaller projects on my own I've used VSCode, which has a fantastic TSLint plugin that highlights linting violations as you make them, and provides access to the auto-fixers that some TSLint rules have. Like this:

是否可以在Visual Studio 2015/2017中获得相同的功能?在编写TypeScript代码时,即时反馈可以节省生命.

Is it possible to get this same functionality in Visual Studio 2015/2017? The immediate feedback is a life saver when writing TypeScript code.

这是我在一两天内编写的代码(请注意,我已经有几年没有使用C#了):

This is something I coded in a day or two (note that I haven't worked with C# for a few years):

https://github.com/vladeck/TSLint

这是(很有希望)具有价值的 Visual Studio 2017 扩展的开始,该扩展可以根据安装的tslinttslint.json配置,使用编辑器标记.ts代码.

It is a start of (hopefully) worth-wile Visual Studio 2017 extension that can mark .ts code withing the editor, based on the installed tslint and tslint.json configuration.

它尚未在市场上发布(还有很多代码要做),但是您可以自己下载并构建它.如果有时间,请尝试一下.尝试的人越多,我将需要更多的数据来使其变得有价值.

It is not published on the marketplace yet (a lot more coding to do), but you can download and build it yourself. Give it a try, If you have the time. The more people try it out, the more I will have data needed to make it worth-wile.