Closed GeneZharov closed 6 years ago
Ah, sounds like you caught a bug in findUndefinedIdentifiers.js. Basically, it needs to pass this test:
it('recognizes destructured assignment to a new name', () => {
expect(findUndefinedIdentifiers(parse(`
import Foo from 'foo';
const { bar: scar } = Foo;
scar();
`))).toEqual(new Set([]));
});
I have limited time right now so any help here would be appreciated!
I will try. Not sure if I succeed. But I will report the results.
If my code contains an object destruction with assigning to new constant name:
Then import-js does not recognize this syntax and tries to import the already defined
langForeignID
constant:This destruction syntax is a part of ES2015: https://www.ecma-international.org/ecma-262/6.0/#sec-destructuring-assignment https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment