millermedeiros / esformatter

ECMAScript code beautifier/formatter
MIT License
970 stars 91 forks source link

question: how to allow inline JSON objects ? #395

Closed gaboesquivel closed 8 years ago

gaboesquivel commented 8 years ago

I would like to know how can I disable JSON object formatting? Eg: If I have this createOrder({ type: orderType }); I run esformatter and it gets reformatted to this

createOrder({ 
   type: orderType 
}); 

I would like to disable that.

millermedeiros commented 8 years ago

there is a plugin to toggle the behavior based on the amount of properties in the object, which is probably what you want: https://github.com/wbinnssmith/esformatter-collapse-objects

if you want to disable multi-line objects altogether you can just set all the ObjectExpression and Property settings to 0 (look for _br.limit{Before|After} and _limit.around inside https://github.com/millermedeiros/esformatter/blob/master/lib/hooks/ObjectExpression.js to see all the available options)

gaboesquivel commented 8 years ago

thanks!