We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
SourceCode#getAncestors
1 parent 4283fd8 commit 90ab539Copy full SHA for 90ab539
apps/oxlint/src-js/plugins/source_code.ts
@@ -520,12 +520,10 @@ export type SourceCode = typeof SOURCE_CODE;
520
function getAncestors(node: Node): Node[] {
521
const ancestors = [];
522
523
- for (
524
- let ancestor = (node as unknown as { parent: Node }).parent;
525
- ancestor;
526
- ancestor = (ancestor as unknown as { parent: Node }).parent
527
- ) {
528
- ancestors.push(ancestor);
+ while (true) {
+ node = (node as unknown as { parent: Node }).parent;
+ if (node === null) break;
+ ancestors.push(node);
529
}
530
531
return ancestors.reverse();
0 commit comments