eslint-utils
eslint-utils copied to clipboard
`getStaticValue` doesn't track references types correctly
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.
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