Set up TSLint for VS2017

后端 未结 4 1066
别那么骄傲
别那么骄傲 2020-12-30 10:55

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

VSIXInstaller.NoApplicableSKUsExce

相关标签:
4条回答
  • 2020-12-30 11:13

    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:

    0 讨论(0)
  • 2020-12-30 11:17

    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.

    0 讨论(0)
  • 2020-12-30 11:26

    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!

    0 讨论(0)
  • 2020-12-30 11:30

    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 讨论(0)
提交回复
热议问题