From 445edb5442171b87b567321df55cb5303f4f68a2 Mon Sep 17 00:00:00 2001 From: Cameron McHenry Date: Wed, 18 Sep 2024 19:50:42 -0400 Subject: [PATCH] Move binding into pattern --- .../src/rules/eslint/no_extend_native.rs | 22 +++++++++---------- 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/crates/oxc_linter/src/rules/eslint/no_extend_native.rs b/crates/oxc_linter/src/rules/eslint/no_extend_native.rs index c0ce9744b1aff..ba178600d8f38 100644 --- a/crates/oxc_linter/src/rules/eslint/no_extend_native.rs +++ b/crates/oxc_linter/src/rules/eslint/no_extend_native.rs @@ -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; } } _ => {}