Skip to content

Conversation

sirbrillig
Copy link
Owner

Because of the more complex scoping rules used for arrow functions, when we look to see if a variable is used within one, we need to know the name of that variable. Previously this was done by reading the 'content' of the token where the variable is found. However, this will not work if the variable is inside a quoted string because the token's content probably contains a lot of other string bits.

In this PR, we instead explicitly provide the detection function with the normalized variable name as we've extracted it from the string.

Fixes #220

@sirbrillig sirbrillig merged commit 6a0b28f into 2.10 Dec 30, 2020
@sirbrillig sirbrillig deleted the fix-arrow-function-used-in-quotes branch December 30, 2020 23:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

False positive for unused/undefined variable in arrow function when used inside double quotes
1 participant