如何在 WebStorm 中保存 TSLint? [英] How can I TSLint on save in WebStorm?

查看:38
本文介绍了如何在 WebStorm 中保存 TSLint?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每次在 WebStorm保存文件时,我如何修复我的 .ts 文件?

我知道我可以在保存后运行 tslint --fix.我也知道我可以在文件中的当前错误上 ⌥⏎ + 并且该错误将被解决.但是我已经习惯了不同的样式指南,如果让这些样式 lint 错误自动修复,我会节省很多时间:

我在 WebStorm 中找不到相关设置:

我也完全愿意使用不同的 cli 工具来实现保存时自动 tslinting.

解决方案

平台当前不支持保存时操作,因为文件由 IDE 自动保存 - 请参阅

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.

解决方案

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

这篇关于如何在 WebStorm 中保存 TSLint?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆