chore(deps): update dependency eslint-plugin-react-hooks to v6 (#4940)
* chore(deps): update dependency eslint-plugin-react-hooks to v6 * fix: update ESLint configuration to use correct imports and recommended settings * chore: clean up unused code and improve readability across components --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Tunglies <77394545+Tunglies@users.noreply.github.com>
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
import js from "@eslint/js";
|
import eslintReact from "@eslint-react/eslint-plugin";
|
||||||
|
import eslintJS from "@eslint/js";
|
||||||
import configPrettier from "eslint-config-prettier";
|
import configPrettier from "eslint-config-prettier";
|
||||||
|
import { createTypeScriptImportResolver } from "eslint-import-resolver-typescript";
|
||||||
import pluginImportX from "eslint-plugin-import-x";
|
import pluginImportX from "eslint-plugin-import-x";
|
||||||
import pluginPrettier from "eslint-plugin-prettier";
|
import pluginPrettier from "eslint-plugin-prettier";
|
||||||
import pluginReactHooks from "eslint-plugin-react-hooks";
|
import pluginReactHooks from "eslint-plugin-react-hooks";
|
||||||
@@ -8,15 +10,13 @@ import pluginUnusedImports from "eslint-plugin-unused-imports";
|
|||||||
import { defineConfig } from "eslint/config";
|
import { defineConfig } from "eslint/config";
|
||||||
import globals from "globals";
|
import globals from "globals";
|
||||||
import tseslint from "typescript-eslint";
|
import tseslint from "typescript-eslint";
|
||||||
import eslintReact from "@eslint-react/eslint-plugin";
|
|
||||||
import { createTypeScriptImportResolver } from "eslint-import-resolver-typescript";
|
|
||||||
|
|
||||||
export default defineConfig([
|
export default defineConfig([
|
||||||
{
|
{
|
||||||
files: ["**/*.{js,mjs,cjs,ts,mts,cts,jsx,tsx}"],
|
files: ["**/*.{js,mjs,cjs,ts,mts,cts,jsx,tsx}"],
|
||||||
|
|
||||||
plugins: {
|
plugins: {
|
||||||
js,
|
js: eslintJS,
|
||||||
"react-hooks": pluginReactHooks,
|
"react-hooks": pluginReactHooks,
|
||||||
// @ts-expect-error -- https://github.com/un-ts/eslint-plugin-import-x/issues/421
|
// @ts-expect-error -- https://github.com/un-ts/eslint-plugin-import-x/issues/421
|
||||||
"import-x": pluginImportX,
|
"import-x": pluginImportX,
|
||||||
@@ -26,7 +26,7 @@ export default defineConfig([
|
|||||||
},
|
},
|
||||||
|
|
||||||
extends: [
|
extends: [
|
||||||
"js/recommended",
|
eslintJS.configs.recommended,
|
||||||
tseslint.configs.recommended,
|
tseslint.configs.recommended,
|
||||||
eslintReact.configs["recommended-typescript"],
|
eslintReact.configs["recommended-typescript"],
|
||||||
configPrettier,
|
configPrettier,
|
||||||
@@ -56,6 +56,8 @@ export default defineConfig([
|
|||||||
{ allowConstantExport: true },
|
{ allowConstantExport: true },
|
||||||
],
|
],
|
||||||
|
|
||||||
|
"@eslint-react/no-forward-ref": "off",
|
||||||
|
|
||||||
// TypeScript
|
// TypeScript
|
||||||
"@typescript-eslint/no-explicit-any": "off",
|
"@typescript-eslint/no-explicit-any": "off",
|
||||||
|
|
||||||
|
|||||||
@@ -93,7 +93,7 @@
|
|||||||
"eslint-import-resolver-typescript": "^4.4.4",
|
"eslint-import-resolver-typescript": "^4.4.4",
|
||||||
"eslint-plugin-import-x": "^4.16.1",
|
"eslint-plugin-import-x": "^4.16.1",
|
||||||
"eslint-plugin-prettier": "^5.5.4",
|
"eslint-plugin-prettier": "^5.5.4",
|
||||||
"eslint-plugin-react-hooks": "^5.2.0",
|
"eslint-plugin-react-hooks": "^6.1.1",
|
||||||
"eslint-plugin-react-refresh": "^0.4.22",
|
"eslint-plugin-react-refresh": "^0.4.22",
|
||||||
"eslint-plugin-unused-imports": "^4.2.0",
|
"eslint-plugin-unused-imports": "^4.2.0",
|
||||||
"glob": "^11.0.3",
|
"glob": "^11.0.3",
|
||||||
|
|||||||
28
pnpm-lock.yaml
generated
28
pnpm-lock.yaml
generated
@@ -193,8 +193,8 @@ importers:
|
|||||||
specifier: ^5.5.4
|
specifier: ^5.5.4
|
||||||
version: 5.5.4(eslint-config-prettier@10.1.8(eslint@9.36.0(jiti@2.6.0)))(eslint@9.36.0(jiti@2.6.0))(prettier@3.6.2)
|
version: 5.5.4(eslint-config-prettier@10.1.8(eslint@9.36.0(jiti@2.6.0)))(eslint@9.36.0(jiti@2.6.0))(prettier@3.6.2)
|
||||||
eslint-plugin-react-hooks:
|
eslint-plugin-react-hooks:
|
||||||
specifier: ^5.2.0
|
specifier: ^6.1.1
|
||||||
version: 5.2.0(eslint@9.36.0(jiti@2.6.0))
|
version: 6.1.1(eslint@9.36.0(jiti@2.6.0))
|
||||||
eslint-plugin-react-refresh:
|
eslint-plugin-react-refresh:
|
||||||
specifier: ^0.4.22
|
specifier: ^0.4.22
|
||||||
version: 0.4.22(eslint@9.36.0(jiti@2.6.0))
|
version: 0.4.22(eslint@9.36.0(jiti@2.6.0))
|
||||||
@@ -2496,9 +2496,9 @@ packages:
|
|||||||
eslint: ^9.36.0
|
eslint: ^9.36.0
|
||||||
typescript: ^5.9.2
|
typescript: ^5.9.2
|
||||||
|
|
||||||
eslint-plugin-react-hooks@5.2.0:
|
eslint-plugin-react-hooks@6.1.1:
|
||||||
resolution: {integrity: sha512-+f15FfK64YQwZdJNELETdn5ibXEUQmW1DZL6KXhNnc2heoy/sg9VJJeT7n8TlMWouzWqSWavFkIhHyIbIAEapg==}
|
resolution: {integrity: sha512-St9EKZzOAQF704nt2oJvAKZHjhrpg25ClQoaAlHmPZuajFldVLqRDW4VBNAS01NzeiQF0m0qhG1ZA807K6aVaQ==}
|
||||||
engines: {node: '>=10'}
|
engines: {node: '>=18'}
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
eslint: ^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0 || ^9.0.0
|
eslint: ^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0 || ^9.0.0
|
||||||
|
|
||||||
@@ -4046,6 +4046,12 @@ packages:
|
|||||||
resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==}
|
resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==}
|
||||||
engines: {node: '>=10'}
|
engines: {node: '>=10'}
|
||||||
|
|
||||||
|
zod-validation-error@4.0.2:
|
||||||
|
resolution: {integrity: sha512-Q6/nZLe6jxuU80qb/4uJ4t5v2VEZ44lzQjPDhYJNztRQ4wyWc6VF3D3Kb/fAuPetZQnhS3hnajCf9CsWesghLQ==}
|
||||||
|
engines: {node: '>=18.0.0'}
|
||||||
|
peerDependencies:
|
||||||
|
zod: ^3.25.0 || ^4.0.0
|
||||||
|
|
||||||
zod@4.1.11:
|
zod@4.1.11:
|
||||||
resolution: {integrity: sha512-WPsqwxITS2tzx1bzhIKsEs19ABD5vmCVa4xBo2tq/SrV4RNZtfws1EnCWQXM6yh8bD08a1idvkB5MZSBiZsjwg==}
|
resolution: {integrity: sha512-WPsqwxITS2tzx1bzhIKsEs19ABD5vmCVa4xBo2tq/SrV4RNZtfws1EnCWQXM6yh8bD08a1idvkB5MZSBiZsjwg==}
|
||||||
|
|
||||||
@@ -6636,9 +6642,15 @@ snapshots:
|
|||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- supports-color
|
- supports-color
|
||||||
|
|
||||||
eslint-plugin-react-hooks@5.2.0(eslint@9.36.0(jiti@2.6.0)):
|
eslint-plugin-react-hooks@6.1.1(eslint@9.36.0(jiti@2.6.0)):
|
||||||
dependencies:
|
dependencies:
|
||||||
|
'@babel/core': 7.28.4
|
||||||
|
'@babel/parser': 7.28.4
|
||||||
eslint: 9.36.0(jiti@2.6.0)
|
eslint: 9.36.0(jiti@2.6.0)
|
||||||
|
zod: 4.1.11
|
||||||
|
zod-validation-error: 4.0.2(zod@4.1.11)
|
||||||
|
transitivePeerDependencies:
|
||||||
|
- supports-color
|
||||||
|
|
||||||
eslint-plugin-react-naming-convention@2.0.1(eslint@9.36.0(jiti@2.6.0))(typescript@5.9.2):
|
eslint-plugin-react-naming-convention@2.0.1(eslint@9.36.0(jiti@2.6.0))(typescript@5.9.2):
|
||||||
dependencies:
|
dependencies:
|
||||||
@@ -8549,6 +8561,10 @@ snapshots:
|
|||||||
|
|
||||||
yocto-queue@0.1.0: {}
|
yocto-queue@0.1.0: {}
|
||||||
|
|
||||||
|
zod-validation-error@4.0.2(zod@4.1.11):
|
||||||
|
dependencies:
|
||||||
|
zod: 4.1.11
|
||||||
|
|
||||||
zod@4.1.11: {}
|
zod@4.1.11: {}
|
||||||
|
|
||||||
zustand@5.0.8(@types/react@19.1.15)(react@19.1.1)(use-sync-external-store@1.5.0(react@19.1.1)):
|
zustand@5.0.8(@types/react@19.1.15)(react@19.1.1)(use-sync-external-store@1.5.0(react@19.1.1)):
|
||||||
|
|||||||
@@ -1,23 +1,19 @@
|
|||||||
|
import { ExpandMoreRounded } from "@mui/icons-material";
|
||||||
import {
|
import {
|
||||||
Box,
|
Box,
|
||||||
Snackbar,
|
Snackbar,
|
||||||
Alert,
|
Alert,
|
||||||
Chip,
|
Chip,
|
||||||
Stack,
|
|
||||||
Typography,
|
Typography,
|
||||||
IconButton,
|
IconButton,
|
||||||
Collapse,
|
|
||||||
Menu,
|
Menu,
|
||||||
MenuItem,
|
MenuItem,
|
||||||
Divider,
|
|
||||||
Button,
|
|
||||||
} from "@mui/material";
|
} from "@mui/material";
|
||||||
import { ArchiveOutlined, ExpandMoreRounded } from "@mui/icons-material";
|
|
||||||
import { useLockFn } from "ahooks";
|
import { useLockFn } from "ahooks";
|
||||||
import { useRef, useState, useEffect, useCallback, useMemo } from "react";
|
import { useRef, useState, useEffect, useCallback, useMemo } from "react";
|
||||||
import useSWR from "swr";
|
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { Virtuoso, type VirtuosoHandle } from "react-virtuoso";
|
import { Virtuoso, type VirtuosoHandle } from "react-virtuoso";
|
||||||
|
import useSWR from "swr";
|
||||||
|
|
||||||
import { useProxySelection } from "@/hooks/use-proxy-selection";
|
import { useProxySelection } from "@/hooks/use-proxy-selection";
|
||||||
import { useVerge } from "@/hooks/use-verge";
|
import { useVerge } from "@/hooks/use-verge";
|
||||||
@@ -34,8 +30,8 @@ import { BaseEmpty } from "../base";
|
|||||||
import { ScrollTopButton } from "../layout/scroll-top-button";
|
import { ScrollTopButton } from "../layout/scroll-top-button";
|
||||||
|
|
||||||
import { ProxyChain } from "./proxy-chain";
|
import { ProxyChain } from "./proxy-chain";
|
||||||
import { ProxyRender } from "./proxy-render";
|
|
||||||
import { ProxyGroupNavigator } from "./proxy-group-navigator";
|
import { ProxyGroupNavigator } from "./proxy-group-navigator";
|
||||||
|
import { ProxyRender } from "./proxy-render";
|
||||||
import { useRenderList } from "./use-render-list";
|
import { useRenderList } from "./use-render-list";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
|
|||||||
@@ -1,11 +1,5 @@
|
|||||||
import { listen } from "@tauri-apps/api/event";
|
import { listen } from "@tauri-apps/api/event";
|
||||||
import React, {
|
import React, { createContext, use, useEffect, useMemo, useRef } from "react";
|
||||||
createContext,
|
|
||||||
useContext,
|
|
||||||
useEffect,
|
|
||||||
useMemo,
|
|
||||||
useRef,
|
|
||||||
} from "react";
|
|
||||||
import useSWR from "swr";
|
import useSWR from "swr";
|
||||||
|
|
||||||
import { useClashInfo } from "@/hooks/use-clash";
|
import { useClashInfo } from "@/hooks/use-clash";
|
||||||
@@ -589,14 +583,12 @@ export const AppDataProvider = ({
|
|||||||
refreshAll,
|
refreshAll,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return (
|
return <AppDataContext value={value}>{children}</AppDataContext>;
|
||||||
<AppDataContext.Provider value={value}>{children}</AppDataContext.Provider>
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// 自定义Hook访问全局数据
|
// 自定义Hook访问全局数据
|
||||||
export const useAppData = () => {
|
export const useAppData = () => {
|
||||||
const context = useContext(AppDataContext);
|
const context = use(AppDataContext);
|
||||||
|
|
||||||
if (!context) {
|
if (!context) {
|
||||||
throw new Error("useAppData必须在AppDataProvider内使用");
|
throw new Error("useAppData必须在AppDataProvider内使用");
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import React, { createContext, useCallback, useContext, useState } from "react";
|
import React, { createContext, useCallback, use, useState } from "react";
|
||||||
|
|
||||||
interface ChainProxyContextType {
|
interface ChainProxyContextType {
|
||||||
isChainMode: boolean;
|
isChainMode: boolean;
|
||||||
@@ -26,7 +26,7 @@ export const ChainProxyProvider = ({
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ChainProxyContext.Provider
|
<ChainProxyContext
|
||||||
value={{
|
value={{
|
||||||
isChainMode,
|
isChainMode,
|
||||||
setChainMode,
|
setChainMode,
|
||||||
@@ -35,12 +35,12 @@ export const ChainProxyProvider = ({
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
</ChainProxyContext.Provider>
|
</ChainProxyContext>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const useChainProxy = () => {
|
export const useChainProxy = () => {
|
||||||
const context = useContext(ChainProxyContext);
|
const context = use(ChainProxyContext);
|
||||||
if (!context) {
|
if (!context) {
|
||||||
throw new Error("useChainProxy must be used within a ChainProxyProvider");
|
throw new Error("useChainProxy must be used within a ChainProxyProvider");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user