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

getStaticValue doesn't track references types correctly #32

Open
RunDevelopment opened this issue Aug 15, 2021 · 1 comment
Open

getStaticValue doesn't track references types correctly #32

RunDevelopment opened this issue Aug 15, 2021 · 1 comment

Comments

@RunDevelopment
Copy link

Example: const a = []; a === a will evaluate to false.

This is because getStaticValue evaluates each reference to a variable separately, so we get different objects with the same value each time. However, they should be the same value.

Solution: Cache the value of each variable.

Non-solution: Change the === operator (among others) to not evaluate the equality of non-value types. This solution simply doesn't scale as built-in safe functions might use === under the hood.

@RunDevelopment RunDevelopment changed the title getStaticValue doesn't track references correctly getStaticValue doesn't track references types correctly Aug 15, 2021
@MichaelDeBoey
Copy link
Contributor

Hi @RunDevelopment!

Since this repo is unmaintained, you might want to re-open this issue in the @eslint-community fork https://github.com/eslint-community/eslint-utils

For more info about why we created this organization, you can read https://eslint.org/blog/2023/03/announcing-eslint-community-org

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

No branches or pull requests

2 participants