mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-11-19 02:12:10 +08:00
chore(deps): update dependency @eslint-react/eslint-plugin to v3 (#6522)
* chore(deps): update dependency @eslint-react/eslint-plugin to v3 * chore: remove deprecated rules * chore: remove eslint from pre-push * chore: update lint-staged config --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Slinetrac <realakayuki@gmail.com>
This commit is contained in:
co-authored by
renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Slinetrac
parent
5ab02e2ef5
commit
13538914be
@@ -1,3 +1,4 @@
|
||||
/* eslint-disable @eslint-react/set-state-in-effect */
|
||||
import {
|
||||
AccessTimeRounded,
|
||||
ChevronRight,
|
||||
@@ -286,7 +287,6 @@ export const CurrentProxyCard = () => {
|
||||
|
||||
// 根据模式确定初始组
|
||||
if (isGlobalMode) {
|
||||
// eslint-disable-next-line @eslint-react/hooks-extra/no-direct-set-state-in-use-effect
|
||||
setState((prev) => ({
|
||||
...prev,
|
||||
selection: {
|
||||
@@ -295,7 +295,6 @@ export const CurrentProxyCard = () => {
|
||||
},
|
||||
}))
|
||||
} else if (isDirectMode) {
|
||||
// eslint-disable-next-line @eslint-react/hooks-extra/no-direct-set-state-in-use-effect
|
||||
setState((prev) => ({
|
||||
...prev,
|
||||
selection: {
|
||||
@@ -305,7 +304,6 @@ export const CurrentProxyCard = () => {
|
||||
}))
|
||||
} else {
|
||||
const savedGroup = readProfileScopedItem(STORAGE_KEY_GROUP)
|
||||
// eslint-disable-next-line @eslint-react/hooks-extra/no-direct-set-state-in-use-effect
|
||||
setState((prev) => ({
|
||||
...prev,
|
||||
selection: {
|
||||
@@ -320,7 +318,6 @@ export const CurrentProxyCard = () => {
|
||||
useEffect(() => {
|
||||
if (!proxies) return
|
||||
|
||||
// eslint-disable-next-line @eslint-react/hooks-extra/no-direct-set-state-in-use-effect
|
||||
setState((prev) => {
|
||||
const groupsMap = new Map<string, ProxyGroupOption>()
|
||||
|
||||
|
||||
@@ -202,7 +202,7 @@ export const EnhancedCanvasTrafficGraph = memo(
|
||||
fpsControllerRef.current.target = GRAPH_CONFIG.targetFPS
|
||||
fpsControllerRef.current.samples = []
|
||||
fpsControllerRef.current.lastAdjustTime = 0
|
||||
// eslint-disable-next-line @eslint-react/hooks-extra/no-direct-set-state-in-use-effect
|
||||
// eslint-disable-next-line @eslint-react/set-state-in-effect
|
||||
setCurrentFPS(GRAPH_CONFIG.targetFPS)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
import React from 'react'
|
||||
import type { ErrorInfo } from 'react'
|
||||
|
||||
import {
|
||||
TrafficErrorBoundary,
|
||||
LightweightTrafficErrorBoundary,
|
||||
} from './traffic-error-boundary'
|
||||
|
||||
interface WithTrafficErrorBoundaryOptions {
|
||||
lightweight?: boolean
|
||||
onError?: (error: Error, errorInfo: ErrorInfo) => void
|
||||
}
|
||||
|
||||
/**
|
||||
* HOC:为任何组件添加流量错误边界
|
||||
*/
|
||||
export function withTrafficErrorBoundary<P extends object>(
|
||||
WrappedComponent: React.ComponentType<P>,
|
||||
options?: WithTrafficErrorBoundaryOptions,
|
||||
) {
|
||||
const WithErrorBoundaryComponent = (props: P) => {
|
||||
const ErrorBoundaryComponent = options?.lightweight
|
||||
? LightweightTrafficErrorBoundary
|
||||
: TrafficErrorBoundary
|
||||
|
||||
return (
|
||||
<ErrorBoundaryComponent onError={options?.onError}>
|
||||
<WrappedComponent {...props} />
|
||||
</ErrorBoundaryComponent>
|
||||
)
|
||||
}
|
||||
|
||||
WithErrorBoundaryComponent.displayName = `withTrafficErrorBoundary(${WrappedComponent.displayName || WrappedComponent.name})`
|
||||
|
||||
return WithErrorBoundaryComponent
|
||||
}
|
||||
Reference in New Issue
Block a user