mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 12:21:58 +00:00
refactor(linter): remove unwrap from bad_comparison_sequence
This commit is contained in:
parent
45f3e4ee1a
commit
4926130e5f
1 changed files with 3 additions and 4 deletions
|
|
@ -58,10 +58,8 @@ fn has_no_bad_comparison_in_parents<'a, 'b>(
|
|||
node: &'b AstNode<'a>,
|
||||
ctx: &'b LintContext<'a>,
|
||||
) -> bool {
|
||||
let mut current_node_id = node.id();
|
||||
loop {
|
||||
current_node_id = ctx.nodes().parent_id(current_node_id).unwrap();
|
||||
let kind = ctx.nodes().kind(current_node_id);
|
||||
for node_id in ctx.nodes().ancestors(node.id()).skip(1) {
|
||||
let kind = ctx.nodes().kind(node_id);
|
||||
|
||||
// `a === b === c === d === e` only produce one error, since `(a === b === c) === d === e` will produce two errors.
|
||||
// So we should treat Parenthesized Expression as a boundary.
|
||||
|
|
@ -76,6 +74,7 @@ fn has_no_bad_comparison_in_parents<'a, 'b>(
|
|||
return false;
|
||||
}
|
||||
}
|
||||
false
|
||||
}
|
||||
|
||||
fn is_bad_comparison(expr: &BinaryExpression) -> bool {
|
||||
|
|
|
|||
Loading…
Reference in a new issue