问题描述
我正在尝试在我的android项目上使用ktlint.
I am trying to use ktlint on my android project.
目前,我正在使用以下gradle插件:
Currently I am using these gradle plugins:
org.jlleitschuh.gradle.ktlint
org.jlleitschuh.gradle.ktlint-idea
我可以使用手动gradle任务检查代码,其中警告将由终端显示.
I can check the code using a manual gradle task, where the warnings will be displayed by the terminal.
是否有可能在javascript中达到eslint之类的东西?例子:
Is it possible to achive something like eslint in javascript? Example:
推荐答案
您不会像eslint一样收到错误消息,但是使用以下方法,您将不需要手动处理ktlint样式问题.它比手动修复问题好吗?
You will not get an error message like in eslint but using following method you won't need to deal with ktlint styling issues manually. Is not it much better than manually fixing things up?
- Install ktlint commandline tools as described here.
- Set IntelliJ IDEA's code styles to align with ktlint's code styles as described here.
因此,当您使用IntelliJ IDEA的提交窗口( + 或 + ),并且在启用提交之前您已经重新格式化了代码,那么您的提交将使用正确的代码样式进行.
So when you make a commit using IntelliJ IDEA's commit window ( + or + ) and you have reformat code before commit enabled then your commit will be made with correct code styles.
这篇关于使用ktlint的实时规则的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!