Search code examples
javascriptnode.jswebstormjetbrains-ideeslint

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?


Solution

  • 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/