How can I TSLint on save in WebStorm?

|▌冷眼眸甩不掉的悲伤 提交于 2021-02-18 22:45:24

问题


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:

I cannot find the relevant settings in WebStorm:

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


回答1:


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



来源:https://stackoverflow.com/questions/45398583/how-can-i-tslint-on-save-in-webstorm

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!