简体   繁体   English

如何在WebStorm中保存TSLint?

[英]How can I TSLint on save in WebStorm?

How can I fix my .ts files everytime I save a file in WebStorm ? 每次在WebStorm中 保存文件时,如何修复 .ts文件?

I know that I can run tslint --fix after saving. 我知道我可以在保存后运行tslint --fix I also know that I can ⌥⏎ + on the current error in the file and that error will be resolved. 我也知道我可以对文件中的当前错误⌥⏎ + and ,并且该错误将得到解决。 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 : 但我已经习惯了不同的样式指南,它可以节省我很多时间来自动修复这些样式lint错误:

tslint错误

I cannot find the relevant settings in WebStorm: 我在WebStorm中找不到相关设置:

WebStorm设置

I would also be completely willing to use a different cli tool to achieve auto tslinting on save . 我也完全愿意使用不同的cli工具来实现保存时的自动创作

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 . 平台目前不支持保存操作,因为IDE会自动保存文件 - 请参阅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. 如果您需要在Save All上运行tslint --fix ,请将其设置为文件观察程序,并禁用此观察程序的立即同步 ,以便在显式保存/更改焦点时触发它。 See the simplest configuration below... You need changing the Program field according to your local settings 请参阅下面最简单的配置...您需要根据本地设置更改“ 程序”字段

在此输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM