-
Notifications
You must be signed in to change notification settings - Fork 13
fixed EsLint errors while deployment #58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -8,20 +8,20 @@ interface User { | |||||
| role?: string; | ||||||
| xp_points?: number; | ||||||
| streak_days?: number; | ||||||
| solvedProblems?: any[]; | ||||||
| activityLog?: any[]; | ||||||
| solvedProblems?: unknown[]; | ||||||
| activityLog?: unknown[]; | ||||||
| } | ||||||
|
|
||||||
| interface AuthContextType { | ||||||
| user: User | null; | ||||||
| profile: any | null; | ||||||
| profile: User | null; | ||||||
| isLoading: boolean; | ||||||
| isAuthReady: boolean; | ||||||
| signIn: (email: string, password: string) => Promise<{ error: any }>; | ||||||
| signUp: (email: string, password: string, name: string) => Promise<{ error: any }>; | ||||||
| signInWithGoogle: (credential?: string) => Promise<{ error: any; isNewUser?: boolean }>; | ||||||
| signIn: (email: string, password: string) => Promise<{ error: string | null }>; | ||||||
| signUp: (email: string, password: string, name: string) => Promise<{ error: string | null }>; | ||||||
| signInWithGoogle: (credential?: string) => Promise<{ error: string | null; isNewUser?: boolean }>; | ||||||
| signOut: () => Promise<void>; | ||||||
| updateProfile: (updates: Record<string, unknown>) => Promise<{ error: any }>; | ||||||
| updateProfile: (updates: Record<string, unknown>) => Promise<{ error: string | null }>; | ||||||
| refreshProfile: () => Promise<void>; | ||||||
| } | ||||||
|
|
||||||
|
|
@@ -31,7 +31,7 @@ const API_BASE_URL = import.meta.env.VITE_API_BASE_URL || 'http://localhost:5000 | |||||
|
|
||||||
| export function AuthProvider({ children }: { children: React.ReactNode }) { | ||||||
| const [user, setUser] = useState<User | null>(null); | ||||||
| const [profile, setProfile] = useState<any | null>(null); | ||||||
| const [profile, setProfile] = useState<User | null>(null); | ||||||
| const isLoading = false; | ||||||
| const [isAuthReady, setIsAuthReady] = useState(false); | ||||||
|
|
||||||
|
|
@@ -121,7 +121,7 @@ export function AuthProvider({ children }: { children: React.ReactNode }) { | |||||
| setProfile({ ...data, id: data.id }); | ||||||
|
|
||||||
| return { error: null }; | ||||||
| } catch (err) { | ||||||
| } catch (_err) { | ||||||
| return { error: 'Network error. Ensure backend is running.' }; | ||||||
| } | ||||||
| }; | ||||||
|
|
@@ -158,7 +158,7 @@ export function AuthProvider({ children }: { children: React.ReactNode }) { | |||||
| setProfile({ ...data, id: data.id }); | ||||||
|
|
||||||
| return { error: null }; | ||||||
| } catch (err) { | ||||||
| } catch (_err) { | ||||||
| return { error: 'Network error. Ensure backend is running.' }; | ||||||
| } | ||||||
| }; | ||||||
|
|
@@ -197,7 +197,7 @@ export function AuthProvider({ children }: { children: React.ReactNode }) { | |||||
| setProfile({ ...data, id: data.id }); | ||||||
|
|
||||||
| return { error: null, isNewUser: data.isNewUser }; | ||||||
| } catch (err) { | ||||||
| } catch (_err) { | ||||||
| return { error: 'Network error during Google Auth' }; | ||||||
| } | ||||||
| }; | ||||||
|
|
@@ -231,7 +231,7 @@ export function AuthProvider({ children }: { children: React.ReactNode }) { | |||||
| return { error: data.message || 'Failed to update profile' }; | ||||||
| } | ||||||
|
|
||||||
| setProfile((prev: any) => ({ ...prev, ...data })); | ||||||
| setProfile((prev) => prev ? { ...prev, ...data } : data); | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win Prevent stale profile resurrection after logout. If Suggested fix- setProfile((prev) => prev ? { ...prev, ...data } : data);
+ setProfile((prev) => (prev ? { ...prev, ...data } : null));📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||
|
|
||||||
| if (user) { | ||||||
| setUser((prevUser) => { | ||||||
|
|
@@ -245,7 +245,7 @@ export function AuthProvider({ children }: { children: React.ReactNode }) { | |||||
| } | ||||||
|
|
||||||
| return { error: null }; | ||||||
| } catch (err) { | ||||||
| } catch (_err) { | ||||||
| return { error: 'Network error. Ensure backend is running.' }; | ||||||
| } | ||||||
| }; | ||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win
no-unused-varsignore regex is overly broad.'^_|err|e'matches almost any identifier containinge, so many real unused variables are silently ignored. Anchor this to exact ignore names instead.Suggested fix
📝 Committable suggestion
🤖 Prompt for AI Agents