Skip to content

Commit dbb0686

Browse files
committed
chore: remove unnecessary "is_in_constructor_root" fn.
1 parent 97dd462 commit dbb0686

File tree

1 file changed

+1
-14
lines changed

1 file changed

+1
-14
lines changed

crates/oxc_linter/src/rules/eslint/no_constructor_return.rs

+1-14
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,7 @@ impl Rule for NoConstructorReturn {
5454
return;
5555
}
5656

57-
let Some(is_in_constructor_root) = is_in_constructor_root(ctx, node.id()) else { return };
58-
59-
if is_in_constructor_root || is_definitely_in_constructor(ctx, node.id()) {
57+
if is_definitely_in_constructor(ctx, node.id()) {
6058
ctx.diagnostic(no_constructor_return_diagnostic(ret.span));
6159
}
6260
}
@@ -69,17 +67,6 @@ fn is_constructor(node: &AstNode<'_>) -> bool {
6967
)
7068
}
7169

72-
/// Checks to see if the given node is in the root of a constructor.
73-
/// Returns `None` if it isn't possible for this node to be in a constructor.
74-
fn is_in_constructor_root(ctx: &LintContext, node_id: AstNodeId) -> Option<bool> {
75-
ctx.nodes()
76-
.ancestors(node_id)
77-
.map(|id| ctx.nodes().get_node(id))
78-
.filter(|it| !matches!(it.kind(), AstKind::BlockStatement(_)))
79-
.nth(3)
80-
.map(is_constructor)
81-
}
82-
8370
fn is_definitely_in_constructor(ctx: &LintContext, node_id: AstNodeId) -> bool {
8471
ctx.nodes()
8572
.ancestors(node_id)

0 commit comments

Comments
 (0)