Skip to content

Commit

Permalink
refactor(linter/oxc): improve code comment for `no-accumulating-sprea…
Browse files Browse the repository at this point in the history
…d` (oxc-project#5373)

mentioned here: oxc-project#5302 (comment)
it's not exactly clear why we check that it's a `let` declaration kind.
  • Loading branch information
camc314 authored and 7086cmd committed Sep 2, 2024
1 parent 66e47f2 commit 9f6fce3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion crates/oxc_linter/src/rules/oxc/no_accumulating_spread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,8 @@ fn check_loop_usage<'a>(
let AstKind::VariableDeclaration(declaration) = declaration_node.kind() else {
return;
};

// if the accumulator's declaration is not a `let`, then we know it's never
// reassigned, hence cannot be a violation of the rule
if !matches!(declaration.kind, VariableDeclarationKind::Let) {
return;
}
Expand Down

0 comments on commit 9f6fce3

Please sign in to comment.