1
votes

I am working with TypeScript in WebStorm for quiet a while, and recently I added TSLint to my setup in order to write better code. I successfully integrated it into the IDE (WebStorm 2016) but I have a bad experience with the IDE formatter combining the TSLint formatting rules.

For example I write:

let bar: foo;  // fine by tslint standarts 

And then I press Ctrl + Alt + L to format everything automatically and I get:

let bar:foo; // without space between the variable ":"
             // and its type the tslint complains

I haven't found any solution on the web and couldn't find a manual way to change this behaviour in the IDE.

Any help will be much appreciated ! :)

1

1 Answers

3
votes

update: since the version 2016.3 the path is: Settings > Editor > Code Style > TypeScript

Go to: Settings > Code Style > TypeScript

Go to the Spaces tab and scroll down to Other

The last 2 options should do the trick:

  • Before type reference colon ':'

  • After type reference colon ':'

Check one or both, depending on what you want.

Screenshot of the settings menu