refactor: remove unused vars and dead code
Cleanup surfaced once the oxlint config actually loads (no-unused-vars). - drop dead locals/imports/params (cachedOffsetTop, elasticOut, key, unused type imports, unused test imports; _-prefix unused mock params) - createVirtualizer: keep the _version read (reactive subscription inside $derived.by) but bind it to _v so it is not flagged - scrollBreadcrumbsStore.test: keep the removeEventListener mock side effect, drop the unread spy binding
This commit is contained in:
@@ -156,7 +156,7 @@ export function createVirtualizer<T>(
|
||||
const offsets = $derived.by(() => {
|
||||
const count = options.count;
|
||||
// Implicit dependency on version signal
|
||||
const v = _version;
|
||||
const _v = _version;
|
||||
const result = new Float64Array(count);
|
||||
let accumulated = 0;
|
||||
for (let i = 0; i < count; i++) {
|
||||
@@ -180,7 +180,7 @@ export function createVirtualizer<T>(
|
||||
// this derivation when the items array is replaced!
|
||||
const { count, data } = options;
|
||||
// Implicit dependency
|
||||
const v = _version;
|
||||
const _v = _version;
|
||||
if (count === 0 || containerHeight === 0 || !data) {
|
||||
return [];
|
||||
}
|
||||
@@ -268,7 +268,6 @@ export function createVirtualizer<T>(
|
||||
return rect.top + scrollY;
|
||||
};
|
||||
|
||||
let cachedOffsetTop = 0;
|
||||
let rafId: number | null = null;
|
||||
containerHeight = typeof window !== 'undefined' ? window.innerHeight : 0;
|
||||
|
||||
@@ -292,14 +291,12 @@ export function createVirtualizer<T>(
|
||||
const handleResize = () => {
|
||||
containerHeight = window.innerHeight;
|
||||
elementOffsetTop = getElementOffset();
|
||||
cachedOffsetTop = elementOffsetTop;
|
||||
handleScroll();
|
||||
};
|
||||
|
||||
// Initial setup
|
||||
requestAnimationFrame(() => {
|
||||
elementOffsetTop = getElementOffset();
|
||||
cachedOffsetTop = elementOffsetTop;
|
||||
handleScroll();
|
||||
});
|
||||
|
||||
|
||||
@@ -3,10 +3,6 @@ import type {
|
||||
TransitionConfig,
|
||||
} from 'svelte/transition';
|
||||
|
||||
function elasticOut(t: number) {
|
||||
return Math.pow(2, -10 * t) * Math.sin((t - 0.075) * (2 * Math.PI) / 0.3) + 1;
|
||||
}
|
||||
|
||||
function gentleSpring(t: number) {
|
||||
return 1 - Math.pow(1 - t, 3) * Math.cos(t * Math.PI * 2);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user