Auto Formatting Assign Destructuring ES6 in IntelliJ / WebStorm

I use airbnb eslint rules to enter ES6 code. One of the rules makes object-curly-spacing .

An example of a rule that uses a destructuring assignment in a function is as follows:

Bad:

 function({a, b}) { } 

Good

 function({ a, b }) { } 

I would really like Intellij / WebStorm to automatically insert these spaces when reformatting the code, however, none of the Codestyle options seem to affect the destructuring. The closest code setting I could find is Object Literal Braces , but it has no effect.

Is it possible to disable this rule, are there additional settings, a plugin, etc. that will automatically insert spaces before and after around the destination of the destructuring?

+5
source share
1 answer

As mentioned in the comments, this option exists in later versions of webstorm / intellij. It was difficult for me to find them, here is a picture of where to find them:

enter image description here

+10
source

Source: https://habr.com/ru/post/1243693/


All Articles