Skip to content

Commit

Permalink
Move binding into pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
camchenry committed Sep 18, 2024
1 parent ea19b08 commit 445edb5
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions crates/oxc_linter/src/rules/eslint/no_extend_native.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,20 +182,18 @@ fn get_property_assignment<'a>(
for parent in ctx.nodes().iter_parents(node.id()).skip(1) {
match parent.kind() {
AstKind::AssignmentExpression(_) => return Some(parent),
AstKind::MemberExpression(member_expr) => {
if let MemberExpression::ComputedMemberExpression(computed) = member_expr {
if let AstKind::MemberExpression(node_expr) = node.kind() {
// Ignore computed member expressions like `obj[Object.prototype] = 0` (i.e., the
// given node is the `expression` of the computed member expression)
if computed
.expression
.as_member_expression()
.is_some_and(|expression| expression.content_eq(node_expr))
{
return None;
}
AstKind::MemberExpression(MemberExpression::ComputedMemberExpression(computed)) => {
if let AstKind::MemberExpression(node_expr) = node.kind() {
// Ignore computed member expressions like `obj[Object.prototype] = 0` (i.e., the
// given node is the `expression` of the computed member expression)
if computed
.expression
.as_member_expression()
.is_some_and(|expression| expression.content_eq(node_expr))
{
return None;
}
return None;
}
}
_ => {}
Expand Down

0 comments on commit 445edb5

Please sign in to comment.