I was just trying out my very first bit of jscodeshift and got immediately stuck with an issue that my object destructuring assignments weren't appearing as bindings. I've tracked it down to an issue here, but it's only an issue when using the babel/babylon parser.
e.g. with this code:
const { a, b } = something;
ast-types correctly reports both a and b as bindings when using the esprima parser, but not when using the babel parser.
I've added a unit test to cover this case, and I've also found a fix for it, which seems to be that the scope code is only looking for Property types when walking across properties, but it should also consider ObjectProperty. I'm not 100% sure that this is the correct fix as I'm new to this codebase...
I was just trying out my very first bit of jscodeshift and got immediately stuck with an issue that my object destructuring assignments weren't appearing as bindings. I've tracked it down to an issue here, but it's only an issue when using the babel/babylon parser.
e.g. with this code:
ast-types
correctly reports botha
andb
as bindings when using the esprima parser, but not when using the babel parser.I've added a unit test to cover this case, and I've also found a fix for it, which seems to be that the
scope
code is only looking forProperty
types when walking acrossproperties
, but it should also considerObjectProperty
. I'm not 100% sure that this is the correct fix as I'm new to this codebase...I'll raise an accompanying PR.