[英]JetBrains WebStorm auto format conflict with ESLint rule no-case-declarations
When setting up ESLint for my project I found that the auto format feature of JetBrains IDE's conflict with the ESLint rule 'no-case-declarations'. 为我的项目设置ESLint时,我发现JetBrains IDE的自动格式功能与ESLint规则“无案例声明”冲突。
The problem is that JetBrains' IDE formats a switch statement such that the block is (non-indented) on a newline which is unwanted behavior but I cannot find a option to turn this behaviour off. 问题是JetBrains的IDE格式化一个switch语句,使得块在换行符上是(非缩进的),这是不需要的行为,但我找不到关闭此行为的选项。
For example, when reformatting this code 例如,重新格式化此代码时
switch(test){
case 1: {
let bla = getBlaForTest(test);
}
}
It will be auto formatted to 它将自动格式化为
switch(test){
case 1:
{
let bla = getBlaForTest(test);
}
}
Which gives an ESLint error that the indenting is wrong (which it is in my opinion). 这给出了ESLint错误,即缩进是错误的(在我看来是这样)。
Does anyone know if this is a limitation of WebStorm or if there is a more advanced way to manage the auto format rules? 有谁知道这是否是WebStorm的限制,或者是否有更高级的方法来管理自动格式规则?
This behaviour is fixed already and fix will be available in WebStorm 2016.2 . 此行为已得到修复,修复将在WebStorm 2016.2中提供 。
You can try WebStorm 2016.2 EAP build right now -- http://blog.jetbrains.com/webstorm/2016/05/webstorm-2016-2-eap-162-232/ 您现在可以尝试使用WebStorm 2016.2 EAP版本 - http://blog.jetbrains.com/webstorm/2016/05/webstorm-2016-2-eap-162-232/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.