Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to configure TSLint in Visual Studio 2015?

TSLint is complaining that single-quotes should be double-quotes. Our team prefers to use single-quotes to wrap string literals.

I see that TSLint is configurable to set the mode to single-quote, but I cannot find a way to set these rules in Visual Studio 2015.

In Options, I found a couple of TSLint options under Text Editor > TypeScript > TSLint:

  • Enable TSLint
  • Warnings as errors

Obviously, these aren't the settings for which I'm looking...

Has anyone found a way to configure the TSLint rules in Visual Studio 2015, or is this something we just have to hope they add in the near future?


This solution: Setup TSLint in Visual Studio 2015

Seems to just be about adding TSLint to Visual Studio 2015 if it doesn't already exist. That's not what I'm looking for either.

like image 327
crush Avatar asked Jun 01 '16 17:06

crush


2 Answers

Tools > Web Code Analysis > Edit TSLint Settings (tslint.json)

like image 124
Clark Avatar answered Nov 15 '22 21:11

Clark


Add tslint.json to your project root and configure it with that. I had hard time to get this to work. Seems that there is a bug somewhere and tslint.json only works when it has Windows line endings. So make sure you have Windows line endings \r\n and not UNIX \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 encoding to UTF-8 it starts to work.

like image 35
Wanton Avatar answered Nov 15 '22 22:11

Wanton