File tree 1 file changed +1
-14
lines changed
crates/oxc_linter/src/rules/eslint
1 file changed +1
-14
lines changed Original file line number Diff line number Diff line change @@ -54,9 +54,7 @@ impl Rule for NoConstructorReturn {
54
54
return ;
55
55
}
56
56
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 ( ) ) {
60
58
ctx. diagnostic ( no_constructor_return_diagnostic ( ret. span ) ) ;
61
59
}
62
60
}
@@ -69,17 +67,6 @@ fn is_constructor(node: &AstNode<'_>) -> bool {
69
67
)
70
68
}
71
69
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
-
83
70
fn is_definitely_in_constructor ( ctx : & LintContext , node_id : AstNodeId ) -> bool {
84
71
ctx. nodes ( )
85
72
. ancestors ( node_id)
You can’t perform that action at this time.
0 commit comments