Closed ivangeorgiew closed 6 years ago
Wow, good catch! Thanks! These bugs can usually be solved pretty quickly with a test-driven approach (`findUndefinedIdentifiers-test.jsx), but knowing how tricky this bit of code is it's probably easiest for me to address. I'll push something soon.
Thanks, its working now. However I found other bugs with fixImports: Here MY_VAR isn't imported.
const bla = {
keyName: obj[MY_VAR]
}
Desctructured aliases are imported, but they shouldn't be: myAlias shouldn't be imported.
const { prop: myAlias } = obj
Good catch! I've moved the new issues into a new ticket so that we can follow up better: #480
When running the fix imports command, variables that are noted as keys in objects like so are not imported:
I tried logging all the nodes inside the function normalizeNode and it is shown that: node.name is MY_VAR, context.key is key, context.parent is ObjectProperty.
Then I tried the same logging for:
And saw that there is no difference between them in the logged information, so I can't make an if/else statement inside function normalizeNode.
Can you fix that or tell how to fix it myself? Thanks in advance.