Skip to content

Commit

Permalink
fix no_setter_return failed
Browse files Browse the repository at this point in the history
  • Loading branch information
Dunqing committed Dec 16, 2024
1 parent f5da19a commit 7e8ba1a
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions crates/oxc_linter/src/rules/eslint/no_setter_return.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,19 @@ impl Rule for NoSetterReturn {
let AstKind::ReturnStatement(stmt) = node.kind() else {
return;
};
if stmt.argument.is_some() && ctx.scopes().get_flags(node.scope_id()).is_set_accessor() {
ctx.diagnostic(no_setter_return_diagnostic(stmt.span));
if stmt.argument.is_none() {
return;
}

for scope_id in ctx.scopes().ancestors(node.scope_id()) {
let flags = ctx.scopes().get_flags(scope_id);
if flags.is_set_accessor() {
ctx.diagnostic(no_setter_return_diagnostic(stmt.span));
} else if flags.is_function() {
break;
} else {
continue;
}
}
}
}
Expand Down

0 comments on commit 7e8ba1a

Please sign in to comment.