简体   繁体   中英

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'.

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.

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).

Does anyone know if this is a limitation of WebStorm or if there is a more advanced way to manage the auto format rules?

This behaviour is fixed already and fix will be available in 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/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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