js2coffee / js2coffee

Compile JavaScript to CoffeeScript

Home Page:http://js2.coffee

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

spacing within arrays

notslang opened this issue · comments

this:

var obj = ['package.json'];

gets converted into this:

obj = [ 'package.json' ]

which should be this:

obj = ['package.json']

This would be the case for everything else, like a+b, str="string" and so on. Keeping coding style consistent from the source to the output would be out of the scope of this plugin, sorry.

No, I don't mean maintaining consistency with the inputted code. The issue I'm bringing up is that putting extra spaces around the contents of an array isn't very common in CoffeeScript. It doesn't appear in the CoffeeScript source, any style-guide I've seen (like polarmobile's or the coffeelint checks), and isn't even used regularly in the code of this module (ref: https://github.com/js2coffee/js2coffee/blob/79602afec817789546d4a3af4b141a78683d2036/test/helpers.coffee and https://github.com/js2coffee/js2coffee/blob/master/lib/transforms/loops.coffee#L139)

Also, this module didn't add any spaces around the contents of arrays before v2.0.0, so this is a fairly recent regression.