clutchski / coffeelint

Lint your CoffeeScript.
http://www.coffeelint.org
Other
1.17k stars 172 forks source link

List comprehension warning when using an already defined variable name #612

Open jneuendorf opened 7 years ago

jneuendorf commented 7 years ago

Hey,

I just had an insane debug session because of something like this:

node = new Node()
# orgNode = node
node.props = (node.prop for node in siblings) # if siblings is not empty
# -> orgNode != node

Of course, after the list comprehension has been executed node is not the previously constructed node. In Python the list comprehension would create a new namespace so this would work. As it does not behave the same in CoffeeScript I would really appreciate a warning about the name clash.