diff --git a/eslint-baseline.txt b/eslint-baseline.txt new file mode 100644 index 0000000..eec668e Binary files /dev/null and b/eslint-baseline.txt differ diff --git a/eslint.config.mjs b/eslint.config.mjs index 8474a18..83d2658 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -7,7 +7,10 @@ export default [ }, ...tsEslint.configs.recommended, { - plugins: { "@next/next": nextPlugin }, + plugins: { + "@next/next": nextPlugin, + "react-hooks": (await import("eslint-plugin-react-hooks")).default + }, rules: { ...nextPlugin.configs["core-web-vitals"].rules, "@typescript-eslint/no-unused-vars": [ diff --git a/package.json b/package.json index 74f4322..255f61f 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,7 @@ "build": "next build", "start": "next start", "lint": "eslint", + "typecheck": "tsc --noEmit", "test": "vitest --run", "test:watch": "vitest", "test:ui": "vitest --ui", diff --git a/src/hooks/useVirtualList.ts b/src/hooks/useVirtualList.ts index 33299f9..1b07e26 100644 --- a/src/hooks/useVirtualList.ts +++ b/src/hooks/useVirtualList.ts @@ -173,7 +173,6 @@ export function useVirtualList( return { offsets: _offsets, heights: _heights, totalHeight: cumulative }; // measureVersion dependency triggers recomputation after DOM measurement. - // eslint-disable-next-line react-hooks/exhaustive-deps }, [items.length, estimatedItemHeight, measureVersion]); // ----------------------------------------------------------------------- diff --git a/tests/hooks/useVirtualList.test.ts b/tests/hooks/useVirtualList.test.ts index 3145b27..a34fcb8 100644 --- a/tests/hooks/useVirtualList.test.ts +++ b/tests/hooks/useVirtualList.test.ts @@ -15,32 +15,7 @@ function makeItems(count: number): Array<{ id: number; label: string }> { } /** Stub the container ref with controllable scrollTop / clientHeight. */ -function mockContainerRef( - hook: ReturnType, unknown>>, - scrollTop = 0, - clientHeight = 400 -) { - const div = document.createElement("div"); - - Object.defineProperties(div, { - scrollTop: { value: scrollTop, writable: true }, - clientHeight: { value: clientHeight, configurable: true }, - scrollTo: { - value: vi.fn(({ top }: ScrollToOptions) => { - Object.defineProperty(div, "scrollTop", { - value: top, - writable: true, - configurable: true, - }); - }), - configurable: true, - }, - }); - // Assign the mock div to the containerRef - (hook.result.current.containerRef as { current: HTMLDivElement | null }).current = div; - return div; -} // --------------------------------------------------------------------------- // Tests diff --git a/tsc-baseline.txt b/tsc-baseline.txt new file mode 100644 index 0000000..e69de29