Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Local variables with identical names declared in different functions considered to be the same variable #133

Open
Tazdraperm opened this issue Feb 28, 2021 · 2 comments
Labels

Comments

@Tazdraperm
Copy link

Expected no warnings here:
image

@YellowAfterlife
Copy link
Owner

The issue here is that the syntax highlighter doesn't really know which sub-function you're in - it is only aware of top-level functions and events since those can be quickly detected with a regular expression while nested functions require parsing the file structure - potentially very often.

Enabling "treat local variables as block-scoped" (or using const/let) will make the linter warnings go away, but syntax highlighter will still have a hard time figuring out which of 3 variables it is supposed to be dealing with. Using descriptive variable names helps.

@Tazdraperm
Copy link
Author

Enabling "treat local variables as block-scoped" did not help, unfortunately. But I guess using better variable names is a reasonable workaround.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants