Skip to content

Properly detect variables used in quotes inside arrow functions #222

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 4 commits into from
Dec 30, 2020

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
# for free to join this conversation on GitHub. Already have an account? # 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