使用 VS 2015 Update 2 配置 tslint [英] Configure tslint with VS 2015 Update 2

查看:19
本文介绍了使用 VS 2015 Update 2 配置 tslint的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法让 tslint 在 Visual Studio 2015 中正常工作.我应该准确地说:

I can't get tslint to work properly in Visual Studio 2015. I should precise that:

  • 我已安装更新 2.
  • 我有 Web Essentials,但它声称它不再包含 linter.
  • 我没有网络分析器.
  • 这是一个 ASP.NET Core xproj,如果这很重要的话.

linter 运行:我可以在错误窗格中看到警告,当我右键单击 TS 文件时,我有一个命令运行 Web 代码分析".

The linter runs: I can see warnings in my error pane and when I right-click a TS file I have a command "Run Web Code Analysis".

现在我想通过在我的项目中添加一个 tslint.json 文件来配置规则(我尝试了很多地方).一旦我添加了一个——即使是我的用户配置文件中默认的副本——我根本不会收到任何警告.

Now I want to configure the rules by adding a tslint.json file in my project (I tried various places). As soon as I add one -- even a copy of the default one from my user profile -- I do get no warning at all.

使用进程监视器,我可以确认 linter 在这两种情况下都运行,并且它从正确的位置(我的项目或我的用户配置文件)读取 tslint.json.但是即使文件完全一样,从我的项目运行时,VS中也没有结果??

Using process monitor I can confirm that the linter runs in both cases and that it reads tslint.json from the correct place (my project or my user profile). But even if the file is exactly the same, when it runs from my project there is no result in VS??

推荐答案

我确实遇到了这个问题.花了几个小时才找到这个,但如果你将行结尾从 UNIX 更改为 Windows/Dos(从 \n 到 \r\n),你可以让 tslint.json 在项目根目录中工作.

I had this exact problem. Took hours to find this but you can make tslint.json work in project root if you change line endings from UNIX to Windows/Dos (from \n to \r\n).

更新:首先我认为是行尾导致了这个问题.但它实际上是 tslint.json 文件编码.如果编码在 Notepad++ 中显示为 UTF-8-BOM,则该文件拒绝工作.如果您将磁贴编码更改为 UTF-8,它就会开始工作.

Update: First I thought it was line endings that was causing this problem. But it's actually tslint.json files encoding. If encoding is shown as UTF-8-BOM in Notepad++ the file refuses to work. If you change tile encoding to UTF-8 it starts to work.

这篇关于使用 VS 2015 Update 2 配置 tslint的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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