Configure tslint with VS 2015 Update 2

自闭症网瘾萝莉.ら 提交于 2019-12-02 03:22:52

问题


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

  • I have Update 2 installed.
  • I have Web Essentials, but it claims that it doesn't includre linters anymore.
  • I do NOT have Web Analyzers.
  • This is an ASP.NET Core xproj, if that matters.

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

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.

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??


回答1:


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

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.



来源:https://stackoverflow.com/questions/37836993/configure-tslint-with-vs-2015-update-2

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