Skip to content

Commit

Permalink
fix(linter): stack overflow in oxc/no-async-endpoint-handlers (#6614)
Browse files Browse the repository at this point in the history
Closes #6583
  • Loading branch information
DonIsaac committed Oct 16, 2024
1 parent 78fe4af commit 41dc8e3
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions crates/oxc_linter/src/rules/oxc/no_async_endpoint_handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down Expand Up @@ -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![
Expand Down

0 comments on commit 41dc8e3

Please sign in to comment.