eslint-utils icon indicating copy to clipboard operation
eslint-utils copied to clipboard

`getStaticValue` doesn't track references types correctly

Open RunDevelopment opened this issue 3 years ago • 1 comments

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 avatar Aug 15 '21 10:08 RunDevelopment

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

MichaelDeBoey avatar Oct 14 '23 16:10 MichaelDeBoey