Fix ESLint errors

This commit is contained in:
adilallo
2026-01-28 11:38:38 -07:00
parent 2e027f5bb2
commit 6b8d646f8a
82 changed files with 217 additions and 193 deletions
@@ -1,7 +1,7 @@
import React from "react";
import { render, screen, waitFor } from "@testing-library/react";
import { render, screen } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import { expect, test, describe, it, vi } from "vitest";
import { expect, describe, it, vi } from "vitest";
import { axe, toHaveNoViolations } from "jest-axe";
import ContextMenu from "../../app/components/ContextMenu";
import ContextMenuItem from "../../app/components/ContextMenuItem";
@@ -39,7 +39,6 @@ describe("ContextMenu Components Accessibility", () => {
});
it("has proper focus management", async () => {
const user = userEvent.setup();
render(
<ContextMenu>
<ContextMenuItem onClick={vi.fn()}>Item 1</ContextMenuItem>
@@ -249,7 +248,6 @@ describe("ContextMenu Components Accessibility", () => {
});
it("maintains proper focus order", async () => {
const user = userEvent.setup();
render(<TestMenu />);
const items = screen.getAllByRole("menuitem");
@@ -340,7 +338,6 @@ describe("ContextMenu Components Accessibility", () => {
});
it("announces selection state changes", async () => {
const user = userEvent.setup();
const { rerender } = render(
<ContextMenuItem onClick={vi.fn()} selected={false}>
Test Item
+1 -2
View File
@@ -1,7 +1,7 @@
import React from "react";
import { render, screen, waitFor } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import { expect, test, describe, it, vi } from "vitest";
import { expect, describe, it, vi } from "vitest";
import { axe, toHaveNoViolations } from "jest-axe";
import Select from "../../app/components/Select";
@@ -136,7 +136,6 @@ describe("Select Component Accessibility", () => {
describe("Screen Reader Support", () => {
it("announces selected option", async () => {
const user = userEvent.setup();
render(<Select {...defaultProps} value="option2" />);
const selectButton = screen.getByRole("button");
+1 -1
View File
@@ -1,4 +1,4 @@
import { expect, test, describe, it, vi } from "vitest";
import { expect, test, describe, vi } from "vitest";
import { render, screen } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import { axe, toHaveNoViolations } from "jest-axe";
+1 -1
View File
@@ -1,4 +1,4 @@
import { expect, test, describe, it, vi } from "vitest";
import { expect, test, describe, vi } from "vitest";
import { render, screen, fireEvent } from "@testing-library/react";
import { axe, toHaveNoViolations } from "jest-axe";
import Toggle from "../../app/components/Toggle";
@@ -102,9 +102,9 @@ test.describe("Accessibility Testing", () => {
// Test Enter key activation
await page.keyboard.press("Enter");
await page.waitForTimeout(100); // Brief pause to see if action occurs
} catch (error) {
} catch (_error) {
// If focus fails, skip this button
console.log(`Could not focus button ${i}: ${error.message}`);
console.log(`Could not focus button ${i}: ${_error.message}`);
continue;
}
}
@@ -332,7 +332,7 @@ test.describe("Accessibility Testing", () => {
// Page should handle errors gracefully
await expect(page.locator("body")).toBeVisible();
} catch (error) {
} catch (_error) {
// If reload fails, that's also acceptable - page should handle errors gracefully
await expect(page.locator("body")).toBeVisible();
}
@@ -168,7 +168,6 @@ describe("RadioButton Accessibility", () => {
});
it("maintains focus management", async () => {
const user = userEvent.setup();
const handleChange = vi.fn();
const { rerender } = render(
@@ -227,7 +227,6 @@ describe("RadioGroup Accessibility", () => {
});
it("maintains focus management", async () => {
const user = userEvent.setup();
const handleChange = vi.fn();
const { rerender } = render(
+5 -5
View File
@@ -39,9 +39,9 @@ describe("Accessibility - Component Level", () => {
// Check for proper heading structure (optional for header components)
try {
const headings = screen.getAllByRole("heading");
screen.getAllByRole("heading");
// Headings are not required in header components, so this is optional
} catch (error) {
} catch {
// No headings found, which is fine for a header component
}
});
@@ -119,10 +119,10 @@ describe("Accessibility - Component Level", () => {
try {
element.focus();
expect(element).toHaveFocus();
} catch (error) {
} catch {
// Some elements might not be focusable in test environment
// This is acceptable for accessibility testing
console.log(`Could not focus element: ${error.message}`);
// Intentionally ignore focus failures in JSDOM
}
});
});
@@ -144,7 +144,7 @@ describe("Accessibility - Component Level", () => {
let headings;
try {
headings = screen.getAllByRole("heading");
} catch (error) {
} catch {
// No headings found, which is fine for a header component
return;
}
@@ -33,27 +33,6 @@ const mockBlogPost = {
"<p>This is the main content of the test article.</p><p>It has multiple paragraphs.</p>",
};
const mockRelatedPosts = [
{
slug: "related-article-1",
frontmatter: {
title: "Related Article 1",
description: "First related article",
author: "Test Author",
date: "2025-04-14",
},
},
{
slug: "related-article-2",
frontmatter: {
title: "Related Article 2",
description: "Second related article",
author: "Test Author",
date: "2025-04-13",
},
},
];
describe("Content Page Rendering E2E", () => {
beforeEach(() => {
vi.clearAllMocks();
+1 -1
View File
@@ -1,5 +1,5 @@
import { describe, it, expect, vi, beforeEach } from "vitest";
import { render, screen, fireEvent } from "@testing-library/react";
import { render, screen } from "@testing-library/react";
import Logo from "../../app/components/Logo";
// Mock Next.js Link component
+1 -1
View File
@@ -239,7 +239,7 @@ test.describe("Edge Cases and Error Scenarios", () => {
// Trigger a harmless error
try {
throw new Error("Test error");
} catch (e) {
} catch (_e) {
// Error handled
}
@@ -1,5 +1,5 @@
import React, { useState } from "react";
import { render, screen, fireEvent, waitFor } from "@testing-library/react";
import { render, screen } from "@testing-library/react";
import { expect, test, describe, vi } from "vitest";
import userEvent from "@testing-library/user-event";
import Checkbox from "../../app/components/Checkbox";
@@ -1,6 +1,5 @@
import { render, screen, cleanup } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import { vi, describe, test, expect, afterEach } from "vitest";
import { describe, test, expect, afterEach } from "vitest";
import ContentLockup from "../../app/components/ContentLockup";
afterEach(() => {
@@ -1,7 +1,7 @@
import React, { useState } from "react";
import { render, screen, waitFor } from "@testing-library/react";
import { render, screen } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import { expect, test, describe, it, vi } from "vitest";
import { expect, describe, it, vi } from "vitest";
import ContextMenu from "../../app/components/ContextMenu";
import ContextMenuItem from "../../app/components/ContextMenuItem";
import ContextMenuSection from "../../app/components/ContextMenuSection";
@@ -77,7 +77,6 @@ describe("ContextMenu Components Integration", () => {
it("shows submenu indicators correctly", () => {
render(<TestMenu onItemClick={vi.fn()} selectedValue="" />);
const setting1 = screen.getByText("Setting 1");
const arrow = screen
.getByRole("menuitem", { name: "Setting 1" })
.querySelector("svg");
@@ -87,7 +86,6 @@ describe("ContextMenu Components Integration", () => {
describe("Keyboard Navigation", () => {
it("navigates through menu items with arrow keys", async () => {
const user = userEvent.setup();
render(<TestMenu onItemClick={vi.fn()} selectedValue="" />);
const items = screen.getAllByRole("menuitem");
@@ -137,7 +135,6 @@ describe("ContextMenu Components Integration", () => {
});
it("skips disabled items during navigation", async () => {
const user = userEvent.setup();
render(<TestMenu onItemClick={vi.fn()} selectedValue="" />);
const items = screen.getAllByRole("menuitem");
@@ -153,7 +150,7 @@ describe("ContextMenu Components Integration", () => {
describe("Dynamic Menu Updates", () => {
const DynamicMenu = ({ items, selectedValue, onItemClick }) => (
<ContextMenu>
{items.map((item, index) => (
{items.map((item) => (
<ContextMenuItem
key={item.id}
onClick={() => onItemClick(item.id)}
@@ -301,7 +298,6 @@ describe("ContextMenu Components Integration", () => {
describe("Performance", () => {
it("handles large menu lists efficiently", async () => {
const user = userEvent.setup();
const largeItems = Array.from({ length: 100 }, (_, i) => ({
id: `item${i}`,
label: `Item ${i}`,
@@ -329,7 +325,6 @@ describe("ContextMenu Components Integration", () => {
});
it("handles rapid state changes", async () => {
const user = userEvent.setup();
const { rerender } = render(
<ContextMenu>
<ContextMenuItem onClick={vi.fn()} selected={false}>
+1 -1
View File
@@ -1,5 +1,5 @@
import React, { useState } from "react";
import { render, screen, fireEvent, waitFor } from "@testing-library/react";
import { render, screen, fireEvent } from "@testing-library/react";
import { expect, test, describe, vi } from "vitest";
import Input from "../../app/components/Input";
@@ -35,7 +35,6 @@ describe("RadioButton Integration", () => {
render(<TestForm />);
const option1 = screen.getByText("Option 1").closest("label");
const option2 = screen.getByText("Option 2").closest("label");
const submitButton = screen.getByRole("button");
@@ -55,7 +54,6 @@ describe("RadioButton Integration", () => {
it("handles keyboard navigation", async () => {
const user = userEvent.setup();
const handleChange = vi.fn();
function KeyboardForm() {
const [value, setValue] = useState("option1");
@@ -52,7 +52,6 @@ describe("RadioGroup Integration", () => {
it("handles keyboard navigation", async () => {
const user = userEvent.setup();
const handleChange = vi.fn();
function KeyboardForm() {
const [value, setValue] = useState("option1");
@@ -1,5 +1,5 @@
import { describe, it, expect, vi, beforeEach } from "vitest";
import { render, screen, fireEvent, waitFor } from "@testing-library/react";
import { render, screen } from "@testing-library/react";
import RelatedArticles from "../../app/components/RelatedArticles";
// Mock ContentThumbnailTemplate
@@ -1,7 +1,7 @@
import React, { useState } from "react";
import { render, screen, waitFor } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import { expect, test, describe, it, vi } from "vitest";
import { expect, describe, it } from "vitest";
import Select from "../../app/components/Select";
describe("Select Component Integration", () => {
@@ -1,5 +1,5 @@
import React from "react";
import { render, screen, fireEvent, waitFor } from "@testing-library/react";
import { render, screen, waitFor } from "@testing-library/react";
import { describe, it, expect, vi } from "vitest";
import userEvent from "@testing-library/user-event";
import Switch from "../../app/components/Switch";
@@ -1,6 +1,6 @@
import React from "react";
import { expect, test, describe, it, vi } from "vitest";
import { render, screen, fireEvent } from "@testing-library/react";
import { expect, test, describe, vi } from "vitest";
import { render, screen } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import TextArea from "../../app/components/TextArea";
@@ -1,5 +1,5 @@
import React from "react";
import { expect, test, describe, it, vi } from "vitest";
import { expect, test, describe, vi } from "vitest";
import { render, screen, fireEvent } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import Toggle from "../../app/components/Toggle";
@@ -120,7 +120,7 @@ describe("ToggleGroup Integration", () => {
});
it("handles state changes", async () => {
const { rerender } = render(<TestForm />);
render(<TestForm />);
const toggleGroups = screen.getAllByRole("button");
// Initially, left should be selected
@@ -182,7 +182,7 @@ describe("ToggleGroup Integration", () => {
});
it("handles rapid state changes", async () => {
const { rerender } = render(<TestForm />);
render(<TestForm />);
const toggleGroups = screen.getAllByRole("button");
// Rapidly change states
@@ -1,6 +1,6 @@
import { render, screen, cleanup } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import { vi, describe, test, expect, afterEach } from "vitest";
import { describe, test, expect, afterEach } from "vitest";
import HeroBanner from "../../app/components/HeroBanner";
import NumberedCards from "../../app/components/NumberedCards";
import RuleStack from "../../app/components/RuleStack";
@@ -1,6 +1,6 @@
import { render, screen, cleanup } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import { vi, describe, test, expect, afterEach } from "vitest";
import { describe, test, expect, afterEach } from "vitest";
import Header from "../../app/components/Header";
import Footer from "../../app/components/Footer";
@@ -129,7 +129,6 @@ describe("User Journey Integration", () => {
});
test("user explores the process through numbered cards", async () => {
const user = userEvent.setup();
render(<Page />);
// Wait for dynamically imported NumberedCards component
@@ -153,7 +152,6 @@ describe("User Journey Integration", () => {
});
test("user accesses contact information through footer", async () => {
const user = userEvent.setup();
render(
<div>
<Header />
@@ -179,7 +177,6 @@ describe("User Journey Integration", () => {
});
test("user explores features and benefits", async () => {
const user = userEvent.setup();
render(<Page />);
// Wait for dynamically imported FeatureGrid component
@@ -201,7 +198,6 @@ describe("User Journey Integration", () => {
});
test("user interacts with logo wall and social proof", async () => {
const user = userEvent.setup();
render(
<div>
<Page />
@@ -232,7 +228,6 @@ describe("User Journey Integration", () => {
});
test("user completes the full journey from discovery to action", async () => {
const user = userEvent.setup();
render(
<div>
<Header />
@@ -278,7 +273,6 @@ describe("User Journey Integration", () => {
});
test("user can access all navigation options consistently", async () => {
const user = userEvent.setup();
render(
<div>
<Header />
+2 -2
View File
@@ -288,7 +288,7 @@ class WebPerformanceMonitor extends PerformanceMonitor {
/**
* Measure page load performance
*/
async measurePageLoad(url) {
async measurePageLoad() {
return this.measureFunction("page_load", async () => {
const start = performance.now();
@@ -337,7 +337,7 @@ class PlaywrightPerformanceMonitor extends PerformanceMonitor {
// Try to wait for the page to be in a usable state
try {
await this.page.waitForLoadState("domcontentloaded", { timeout: 10000 });
} catch (e) {
} catch {
throw new Error(`Page failed to load: ${error.message}`);
}
} else {
@@ -164,7 +164,6 @@ export const SingleSelectionInteraction = {
export const FormIntegration = {
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
const radioGroup = canvas.getByRole("radiogroup");
const radioButtons = canvas.getAllByRole("radio");
// Should have hidden inputs for form submission
@@ -63,7 +63,6 @@ test.describe("RadioGroup Storybook Tests", () => {
test("interacts with controls", async ({ page }) => {
// Test mode control
await page.selectOption('[data-testid="mode-control"]', "inverse");
const radioGroup = page.locator('[role="radiogroup"]');
const radioButtons = page.locator('[role="radio"]');
// All radio buttons should have inverse styling
+1 -1
View File
@@ -60,7 +60,7 @@ vi.mock("../../app/components/ContentBanner", () => {
vi.mock("../../app/components/RelatedArticles", () => {
return {
default: ({ relatedPosts, currentPostSlug }) => (
default: ({ relatedPosts }) => (
<div data-testid="related-articles">
<h2>Related Articles</h2>
{relatedPosts.map((post) => (
+2 -2
View File
@@ -1,7 +1,7 @@
import React from "react";
import { render, screen, fireEvent } from "@testing-library/react";
import { render, screen } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import { expect, test, describe, it, vi, beforeEach } from "vitest";
import { expect, describe, it, vi, beforeEach } from "vitest";
import { axe, toHaveNoViolations } from "jest-axe";
import ContextMenu from "../../app/components/ContextMenu";
import ContextMenuItem from "../../app/components/ContextMenuItem";
+1 -2
View File
@@ -1,6 +1,5 @@
import { render, screen, cleanup } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import { vi, describe, test, expect, afterEach } from "vitest";
import { describe, test, expect, afterEach } from "vitest";
import FeatureGrid from "../../app/components/FeatureGrid";
afterEach(() => {
-1
View File
@@ -1,6 +1,5 @@
import { describe, test, expect } from "vitest";
import { render, screen } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import Footer from "../../app/components/Footer";
describe("Footer", () => {
+1 -2
View File
@@ -1,6 +1,5 @@
import { describe, test, expect, vi, beforeEach } from "vitest";
import { describe, test, expect, beforeEach } from "vitest";
import { render, screen } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import Header, {
navigationItems,
avatarImages,
+1 -2
View File
@@ -1,6 +1,5 @@
import { render, screen, cleanup } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import { vi, describe, test, expect, afterEach } from "vitest";
import { describe, test, expect, afterEach } from "vitest";
import HeroBanner from "../../app/components/HeroBanner";
afterEach(() => {
+1 -2
View File
@@ -1,6 +1,5 @@
import { render, screen, cleanup } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import { vi, describe, test, expect, afterEach } from "vitest";
import { describe, test, expect, afterEach } from "vitest";
import LogoWall from "../../app/components/LogoWall";
afterEach(() => {
+1 -2
View File
@@ -1,6 +1,5 @@
import { render, screen, cleanup } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import { vi, describe, test, expect, afterEach } from "vitest";
import { describe, test, expect, afterEach } from "vitest";
import NumberedCards from "../../app/components/NumberedCards";
afterEach(() => {
-1
View File
@@ -1,5 +1,4 @@
import { render, screen, cleanup } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import { vi, describe, test, expect, afterEach } from "vitest";
import QuoteBlock from "../../app/components/QuoteBlock";
+1 -1
View File
@@ -1,5 +1,5 @@
import React from "react";
import { render, screen, fireEvent } from "@testing-library/react";
import { render, screen } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import { describe, it, expect, vi } from "vitest";
import RadioButton from "../../app/components/RadioButton";
+2 -2
View File
@@ -1,5 +1,5 @@
import { describe, it, expect, vi, beforeEach } from "vitest";
import { render, screen, waitFor } from "@testing-library/react";
import { describe, expect, vi, beforeEach, it } from "vitest";
import { render, screen } from "@testing-library/react";
import RelatedArticles from "../../app/components/RelatedArticles";
// Mock Next.js components
+2 -3
View File
@@ -1,7 +1,6 @@
import React from "react";
import { render, screen, fireEvent, waitFor } from "@testing-library/react";
import { render, screen, waitFor } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import { expect, test, describe, it, vi } from "vitest";
import { expect, describe, it, vi } from "vitest";
import { axe, toHaveNoViolations } from "jest-axe";
import Select from "../../app/components/Select";
-1
View File
@@ -1,4 +1,3 @@
import React from "react";
import { render, screen, fireEvent } from "@testing-library/react";
import { describe, it, expect, vi } from "vitest";
import Switch from "../../app/components/Switch";
+1 -1
View File
@@ -1,4 +1,4 @@
import { expect, test, describe, it, vi } from "vitest";
import { expect, test, describe, vi } from "vitest";
import { render, screen } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import TextArea from "../../app/components/TextArea";
+1 -1
View File
@@ -1,4 +1,4 @@
import { expect, test, describe, it, vi } from "vitest";
import { expect, test, describe, vi } from "vitest";
import { render, screen, fireEvent } from "@testing-library/react";
import Toggle from "../../app/components/Toggle";
-1
View File
@@ -1,4 +1,3 @@
import React from "react";
import { render, screen, fireEvent } from "@testing-library/react";
import { describe, it, expect, vi } from "vitest";
import ToggleGroup from "../../app/components/ToggleGroup";
+2 -2
View File
@@ -4,7 +4,7 @@ import { useClickOutside } from "../../../app/hooks/useClickOutside";
import { useRef } from "react";
describe("useClickOutside", () => {
let handler: ReturnType<typeof vi.fn>;
let handler;
beforeEach(() => {
handler = vi.fn();
@@ -55,7 +55,7 @@ describe("useClickOutside", () => {
});
test("does not call handler when disabled", () => {
const { result } = renderHook(() => {
renderHook(() => {
const ref = useRef(null);
useClickOutside([ref], handler, false);
return ref;