How can I TSLint on save in WebStorm?
Asked Answered
V

1

9

How can I fix my .ts files everytime I save a file in WebStorm?

I know that I can run tslint --fix after saving. I also know that I can ⌥⏎ + on the current error in the file and that error will be resolved. But I am used to a different styleguide and it would save me a lot of time to have these style lint errors to be auto fixed:

tslint error

I cannot find the relevant settings in WebStorm:

WebStorm settings

I would also be completely willing to use a different cli tool to achieve auto tslinting on save.

Valaree answered 30/7, 2017 at 9:58 Comment(1)
File Watchers -- they run automatically on file save. 1) General info confluence.jetbrains.com/display/PhpStorm/… 2) Official Help page: jetbrains.com/help/webstorm/file-watchers.html?search=file%20waUnchaste
A
19

On-save actions are not currently supported by the platform, as files are auto-saved by the IDE - see https://youtrack.jetbrains.com/issue/IDEABKL-6722. If you need to run tslint --fix on Save All, set it up as a file watcher, and disable immediate synchronization for this watcher, so that it's triggered on explicit Save/changing focus. See the simplest configuration below... You need changing the Program field according to your local settings

enter image description here

Amundson answered 31/7, 2017 at 16:4 Comment(1)
Thank you! Really nice solution:)Katekatee

© 2022 - 2024 — McMap. All rights reserved.