From 41dc8e314ea8d4288b309a389ad1356d517d4d65 Mon Sep 17 00:00:00 2001 From: DonIsaac <22823424+DonIsaac@users.noreply.github.com> Date: Wed, 16 Oct 2024 06:37:11 +0000 Subject: [PATCH] fix(linter): stack overflow in `oxc/no-async-endpoint-handlers` (#6614) Closes #6583 --- .../src/rules/oxc/no_async_endpoint_handlers.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/crates/oxc_linter/src/rules/oxc/no_async_endpoint_handlers.rs b/crates/oxc_linter/src/rules/oxc/no_async_endpoint_handlers.rs index bb25775aa..60bc927e3 100644 --- a/crates/oxc_linter/src/rules/oxc/no_async_endpoint_handlers.rs +++ b/crates/oxc_linter/src/rules/oxc/no_async_endpoint_handlers.rs @@ -231,6 +231,15 @@ impl NoAsyncEndpointHandlers { AstKind::Function(f) => self.check_function(ctx, registered_at, id_name, f), AstKind::VariableDeclarator(decl) => { if let Some(init) = &decl.init { + if let Expression::Identifier(id) = &init { + if decl + .id + .get_identifier() + .is_some_and(|declared| declared == id.name) + { + return; + } + } self.check_endpoint_expr(ctx, id_name, registered_at, init); } } @@ -334,6 +343,14 @@ fn test() { ", Some(json!([ { "allowedNames": ["middleware"] } ])), ), + // https://github.com/oxc-project/oxc/issues/6583 + ( + " + class B{o(a={}){const attribute=attribute + c.get(attribute)}} + ", + None, + ), ]; let fail = vec![