refactor: codebase linting

This commit is contained in:
melvinchia3636
2026-06-10 18:46:34 +08:00
parent 4549bb6f80
commit b8ac80b9be
113 changed files with 377 additions and 214 deletions

View File

@@ -58,7 +58,8 @@ export function APIOnlineStatusProvider({
}) {
const apiEndpoint = useAPIEndpoint()
const [isOnline, setIsOnline] = useState<boolean | 'loading'>('loading')
const [environment, setEnvironment] = useState<
const [environment, setEnvironment] = useState<
'production' | 'development' | null
>(null)
const handleRetry = useCallback(() => {

View File

@@ -68,7 +68,8 @@ export function AuthProvider({
const [userData, setUserData] = useState<UserData | null>(null)
const [authLoading, setAuthLoading] = useState(true)
const tid = useRef('')
const setAuth = useCallback(
const setAuth = useCallback(
(value: boolean) => {
_setAuth(value)
},

View File

@@ -25,7 +25,8 @@ export function EncryptionProvider({
}: EncryptionProviderProps) {
const [ready, setReady] = useState(hasServerPublicKey())
const [error, setError] = useState<string | null>(null)
useEffect(() => {
useEffect(() => {
if (ready) return
initializeEncryption(apiHost)

View File

@@ -21,7 +21,8 @@ export interface SocketEvent<
export function SocketProvider({ children }: { children: React.ReactNode }) {
const apiHost = useAPIEndpoint()
const [socket, setSocket] = useState<Socket | null>(null)
useEffect(() => {
useEffect(() => {
const newSocket = io(apiHost, {
auth: {
token: localStorage.getItem('session')

View File

@@ -6,7 +6,8 @@ export function usePromiseLoading<T extends any[]>(
onError?: (error: unknown) => void
): [boolean, (...args: T) => Promise<void>] {
const [isLoading, setIsLoading] = useState(false)
const onClick = useCallback(
const onClick = useCallback(
async (...args: T) => {
setIsLoading(true)