chore: Lint extensions folder.

This commit is contained in:
cpojer
2026-01-31 22:13:48 +09:00
parent 4f2166c503
commit 230ca789e2
221 changed files with 4006 additions and 1583 deletions

View File

@@ -56,19 +56,27 @@ export function createSeenTracker(options?: SeenTrackerOptions): SeenTracker {
// Move an entry to the front (most recently used)
function moveToFront(id: string): void {
const entry = entries.get(id);
if (!entry) return;
if (!entry) {
return;
}
// Already at front
if (head === id) return;
if (head === id) {
return;
}
// Remove from current position
if (entry.prev) {
const prevEntry = entries.get(entry.prev);
if (prevEntry) prevEntry.next = entry.next;
if (prevEntry) {
prevEntry.next = entry.next;
}
}
if (entry.next) {
const nextEntry = entries.get(entry.next);
if (nextEntry) nextEntry.prev = entry.prev;
if (nextEntry) {
nextEntry.prev = entry.prev;
}
}
// Update tail if this was the tail
@@ -81,29 +89,39 @@ export function createSeenTracker(options?: SeenTrackerOptions): SeenTracker {
entry.next = head;
if (head) {
const headEntry = entries.get(head);
if (headEntry) headEntry.prev = id;
if (headEntry) {
headEntry.prev = id;
}
}
head = id;
// If no tail, this is also the tail
if (!tail) tail = id;
if (!tail) {
tail = id;
}
}
// Remove an entry from the linked list
function removeFromList(id: string): void {
const entry = entries.get(id);
if (!entry) return;
if (!entry) {
return;
}
if (entry.prev) {
const prevEntry = entries.get(entry.prev);
if (prevEntry) prevEntry.next = entry.next;
if (prevEntry) {
prevEntry.next = entry.next;
}
} else {
head = entry.next;
}
if (entry.next) {
const nextEntry = entries.get(entry.next);
if (nextEntry) nextEntry.prev = entry.prev;
if (nextEntry) {
nextEntry.prev = entry.prev;
}
} else {
tail = entry.prev;
}
@@ -111,7 +129,9 @@ export function createSeenTracker(options?: SeenTrackerOptions): SeenTracker {
// Evict the least recently used entry
function evictLRU(): void {
if (!tail) return;
if (!tail) {
return;
}
const idToEvict = tail;
removeFromList(idToEvict);
entries.delete(idToEvict);
@@ -139,7 +159,9 @@ export function createSeenTracker(options?: SeenTrackerOptions): SeenTracker {
if (pruneIntervalMs > 0) {
pruneTimer = setInterval(pruneExpired, pruneIntervalMs);
// Don't keep process alive just for pruning
if (pruneTimer.unref) pruneTimer.unref();
if (pruneTimer.unref) {
pruneTimer.unref();
}
}
function add(id: string): void {
@@ -167,12 +189,16 @@ export function createSeenTracker(options?: SeenTrackerOptions): SeenTracker {
if (head) {
const headEntry = entries.get(head);
if (headEntry) headEntry.prev = id;
if (headEntry) {
headEntry.prev = id;
}
}
entries.set(id, newEntry);
head = id;
if (!tail) tail = id;
if (!tail) {
tail = id;
}
}
function has(id: string): boolean {
@@ -198,7 +224,9 @@ export function createSeenTracker(options?: SeenTrackerOptions): SeenTracker {
function peek(id: string): boolean {
const entry = entries.get(id);
if (!entry) return false;
if (!entry) {
return false;
}
// Check if expired
if (Date.now() - entry.seenAt > ttlMs) {
@@ -248,12 +276,16 @@ export function createSeenTracker(options?: SeenTrackerOptions): SeenTracker {
if (head) {
const headEntry = entries.get(head);
if (headEntry) headEntry.prev = id;
if (headEntry) {
headEntry.prev = id;
}
}
entries.set(id, newEntry);
head = id;
if (!tail) tail = id;
if (!tail) {
tail = id;
}
}
}
}