✅ ESLint CLI Migration: - Migrated from deprecated 'next lint' to modern 'eslint .' - Updated package.json script: 'lint': 'eslint .' - Updated eslint.config.mjs with Next.js ignores - No more deprecation warnings ✅ Fixed ESLint Errors: - Added displayName to React components in jest.setup.ts - Replaced 'any' types with proper TypeScript types - Fixed require() import in next.config.ts → ES6 import - Fixed Difficulty enum values (Beginner → BEGINNER, etc.) ✅ Build Status: - ESLint: 0 errors, 0 warnings ✅ - TypeScript: All type errors resolved ✅ - Build: Successful compilation ✅ - 22 routes generated successfully ✅ 🎯 Ready for Next.js 16: - No deprecated dependencies - Modern ESLint configuration - Future-proof codebase
43 lines
1.4 KiB
TypeScript
43 lines
1.4 KiB
TypeScript
import 'whatwg-fetch';
|
|
import React from "react";
|
|
import { render } from '@testing-library/react';
|
|
import { ToastProvider } from '@/components/Toast';
|
|
|
|
// Mock react-responsive-masonry
|
|
jest.mock("react-responsive-masonry", () => ({
|
|
__esModule: true,
|
|
default: ({ children }: { children: React.ReactNode }) =>
|
|
React.createElement("div", null, children),
|
|
get ResponsiveMasonry() {
|
|
const ResponsiveMasonryComponent = ({ children }: { children: React.ReactNode }) =>
|
|
React.createElement("div", null, children);
|
|
ResponsiveMasonryComponent.displayName = 'ResponsiveMasonry';
|
|
return ResponsiveMasonryComponent;
|
|
},
|
|
}));
|
|
|
|
// Mock next/link
|
|
jest.mock('next/link', () => {
|
|
const LinkComponent = ({ children }: { children: React.ReactNode }) => children;
|
|
LinkComponent.displayName = 'Link';
|
|
return LinkComponent;
|
|
});
|
|
|
|
// Mock next/image
|
|
jest.mock('next/image', () => {
|
|
const ImageComponent = ({ src, alt, ...props }: Record<string, unknown>) =>
|
|
React.createElement('img', { src, alt, ...props });
|
|
ImageComponent.displayName = 'Image';
|
|
return ImageComponent;
|
|
});
|
|
|
|
// Custom render function with ToastProvider
|
|
const customRender = (ui: React.ReactElement, options = {}) =>
|
|
render(ui, {
|
|
wrapper: ({ children }) => React.createElement(ToastProvider, null, children),
|
|
...options,
|
|
});
|
|
|
|
// Re-export everything
|
|
export * from '@testing-library/react';
|
|
export { customRender as render }; |