最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Set up TSLint for VS2017 - Stack Overflow

programmeradmin0浏览0评论

I have tried to install this plugin: Web Analyzer, but unfortunately it can not be installed in VS 2017. It showed:

VSIXInstaller.NoApplicableSKUsException: This extension is not installable on any currently installed products.

I am wondering whether there is a way to set up tslint in VS or there is any other way to check the syntax?

I have tried to install this plugin: Web Analyzer, but unfortunately it can not be installed in VS 2017. It showed:

VSIXInstaller.NoApplicableSKUsException: This extension is not installable on any currently installed products.

I am wondering whether there is a way to set up tslint in VS or there is any other way to check the syntax?

Share Improve this question edited Mar 29, 2018 at 7:59 MSeifert 153k41 gold badges350 silver badges366 bronze badges asked Mar 16, 2017 at 3:24 KuawiiiiKuawiiii 1511 silver badge8 bronze badges 0
Add a comment  | 

4 Answers 4

Reset to default 7

Since this is the top google result, I wanted to add a more recent answer. Microsoft has a tslint plugin now that works with Typescript 3+ and across Visual Studio, VSCode and other editors:

https://github.com/Microsoft/typescript-tslint-plugin

Setup

Install Dependencies

npm install --save-dev typescript tslint typescript-tslint-plugin

Add to tsconfig.json:

{
  "compilerOptions": {
    "plugins": [
      {
        "name": "typescript-tslint-plugin"
      }
    ]
  }
}

Develop with lint!

Now that TypeScript has language server plugins support and there's TSLint plugin, another option is available:

  • Install Visual Studio 2017 Update 2
  • Install TypeScript 2.3 for Visual Studio (This is not only for VS 2015 but also for VS 2017 Update 2)
  • Put tslint.json in C:\Program Files (x86)\Microsoft SDKs\TypeScript\2.3 or any of its parent directories and run npm install typescript tslint tslint-language-service (Visual Studio doesn't search for tslint.json or plugins in the project folder)
  • Add "plugins": [{ "name": "tslint-language-service" }] to compilerOptions in your tsconfig.json

Now TSLint in Visual Studio should work:

Thanks to Rich N, now there is TypeScript Analyzer for Visual Studio 2017. See his answer to an SO question on the same topic here.

Web Analyser is there installed as part of Visual Studio 2017. The bad news: without tslint.

I suspect (was hoping) that it can be done using the taskrunner and gulp and piping the output back into the Visual Studio 2017 errors window (using the 'msbuild' output of tslint), but when I tried this I couldn't get it to work, and I don't have the time to work it out why. It may be this output option is not supported in vs2017.

My solution was to roll back to vs2015 community. (I also got back the code lens feature which I had grown to depend on.) I'm hoping that these things will come back to vs eventually, so I can move forward to some of the new features.

UPDATE: Rich Newman has written a replacement called TypeScript Analyzerfor vs2017 https://marketplace.visualstudio.com/items?itemName=RichNewman.TypeScriptAnalyzer

发布评论

评论列表(0)

  1. 暂无评论