eslint: fixed warnings and disabled exhaustive-deps rule

This commit is contained in:
corgifist 2025-07-20 16:28:27 +03:00
parent 9d3f140844
commit acda651d82
9 changed files with 32 additions and 51 deletions

View File

@ -6,11 +6,16 @@ const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
baseDirectory: __dirname,
});
const eslintConfig = [
...compat.extends("next/core-web-vitals", "next/typescript"),
...compat.extends("next/core-web-vitals", "next/typescript"),
{
rules: {
'react-hooks/exhaustive-deps': 'off'
}
}
];
export default eslintConfig;

4
package-lock.json generated
View File

@ -1,11 +1,11 @@
{
"name": "clipfusion-community",
"name": "clipfusion-editor",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clipfusion-community",
"name": "clipfusion-editor",
"version": "1.0.0",
"dependencies": {
"@hookform/resolvers": "^5.1.1",

View File

@ -1,5 +1,5 @@
{
"name": "clipfusion-community",
"name": "clipfusion-editor",
"version": "1.0.0",
"private": true,
"scripts": {

View File

@ -1,11 +1,10 @@
import type { Metadata } from "next";
import { Geist, Geist_Mono } from "next/font/google";
import { ReactNode } from "react";
import { ThemeProvider } from "next-themes";
import { SidebarProvider } from "@/components/ui/sidebar";
import Dashboard from "@/components/dashboard";
import "./globals.css";
import Providers from "./providers";
import ThemeProvider from "./theme-provider";
const geist = Geist({
variable: "--font-geist",
@ -32,14 +31,14 @@ export default function RootLayout({
<html lang="en" suppressHydrationWarning>
<head/>
<body className={`${geist.variable} ${geistMono.variable} antialiased`}>
<Providers>
<ThemeProvider>
<SidebarProvider>
<Dashboard/>
<main>
{children}
</main>
</SidebarProvider>
</Providers>
</ThemeProvider>
</body>
</html>
);

View File

@ -1,17 +0,0 @@
"use client";
import { ThemeProvider } from "next-themes";
import { ReactNode } from "react";
const Providers = ({
children
}: {
children: ReactNode
}): ReactNode => {
return (
<ThemeProvider attribute="class" defaultTheme="system" enableSystem disableTransitionOnChange>
{children}
</ThemeProvider>
)
};
export default Providers;

View File

@ -0,0 +1,13 @@
"use client";
import { ThemeProvider as NextThemeProvider } from "next-themes";
import { ComponentProps, ReactNode } from "react";
const ThemeProvider = (props: ComponentProps<typeof NextThemeProvider>): ReactNode => {
return (
<ThemeProvider {...props} attribute="class" defaultTheme="system" enableSystem disableTransitionOnChange>
{props.children}
</ThemeProvider>
)
};
export default ThemeProvider;

View File

@ -1,19 +1,12 @@
"use client";
import { FolderOpenIcon, HomeIcon, LucideIcon, PlusIcon, SettingsIcon } from "lucide-react";
import { useTheme } from "next-themes";
import { ReactNode, useState, useCallback, useEffect } from "react";
import { SidebarMenuItem, SidebarMenuButton, SidebarContent, SidebarGroup, SidebarGroupContent, SidebarMenu, SidebarHeader, SidebarSeparator, SidebarFooter, Sidebar, SidebarGroupLabel, SidebarGroupAction } from "../ui/sidebar";
import { FolderOpenIcon, LucideIcon, PlusIcon, SettingsIcon } from "lucide-react";
import { ReactNode } from "react";
import { SidebarMenuItem, SidebarMenuButton, SidebarContent, SidebarGroup, SidebarGroupContent, SidebarMenu, SidebarHeader, SidebarFooter, Sidebar, SidebarGroupLabel, SidebarGroupAction } from "../ui/sidebar";
import Link from "next/link";
import Image from "next/image";
import { Switch } from "../ui/switch";
import { Label } from "../ui/label";
import ClipFusionLogo from "../clipfusion-logo";
import { Input } from "../ui/input";
import Search from "../search";
import ThemeSwitcher from "../theme-switcher";
const WHITESPACE_REGEX = /\s+/g;
interface DashboardItem {
title: string;
icon: LucideIcon;
@ -35,18 +28,6 @@ const items: DashboardItem[] = [
export const Dashboard = (): ReactNode => {
const { theme, setTheme } = useTheme();
const [darkModeChecked, setDarkModeChecked] = useState(false);
const darkModeCallback = useCallback((checked: boolean) => {
setTheme(checked ? "dark" : "light");
setDarkModeChecked(checked);
}, []);
useEffect(() => {
setDarkModeChecked(theme == "dark");
}, []);
return (
<Sidebar>
<SidebarHeader className="flex justify-center items-center">

View File

@ -15,11 +15,11 @@ export const ThemeSwitcher = ({
const onThemeChange = useCallback(() => {
setTheme(theme == "dark" ? "light" : "dark");
setDark(!dark);
}, [theme, dark]);
}, [theme, dark, setTheme]);
useEffect(() => {
setDark(theme == "dark");
}, []);
});
return (
<Toggle pressed={dark} onPressedChange={onThemeChange}>

View File

@ -3,7 +3,7 @@
import * as React from "react"
import { Slot } from "@radix-ui/react-slot"
import { cva, VariantProps } from "class-variance-authority"
import { PanelLeftCloseIcon, PanelLeftIcon, PanelLeftOpenIcon } from "lucide-react"
import { PanelLeftCloseIcon, PanelLeftOpenIcon } from "lucide-react"
import { useIsMobile } from "@/hooks/use-mobile"
import { cn } from "@/lib/utils"