💅 Incorrect Linting Suggestion for useLiteralKeys with __proto__ as Computed Property #2430
Closed
1 task done
Labels
A-Linter
Area: linter
S-Bug-confirmed
Status: report has been confirmed as a valid bug
S-Help-wanted
Status: you're familiar with the code base and want to help the project
Environment information
Rule name
lint/complexity/useLiteralKeys
Playground link
https://biomejs.dev/playground/?code=YwBvAG4AcwB0ACAAbwBiAGoAIAA9ACAAewBbACIAXwBfAHAAcgBvAHQAbwBfAF8AIgBdADoAIAB0AHIAdQBlAH0AOwA%3D
Expected result
The useLiteralKeys rule suggests that object literals with computed properties such as
{["__proto__"]: true}
can be simplified to{__proto__: true}
. However, this suggestion is incorrect due to the different ways JavaScript handles these syntaxes. In JavaScript,{["__proto__"]: true}
does not modify the object's prototype, whereas{__proto__: true}
does, potentially leading to unexpected behavior.Code of Conduct
The text was updated successfully, but these errors were encountered: