fix: Resolve all ESLint errors and warnings in web package
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
Fixes all 542 ESLint problems in the web package to achieve 0 errors and 0 warnings. Changes: - Fixed 144 issues: nullish coalescing, return types, unused variables - Fixed 118 issues: unnecessary conditions, type safety, template literals - Fixed 79 issues: non-null assertions, unsafe assignments, empty functions - Fixed 67 issues: explicit return types, promise handling, enum comparisons - Fixed 45 final warnings: missing return types, optional chains - Fixed 25 typecheck-related issues: async/await, type assertions, formatting - Fixed JSX.Element namespace errors across 90+ files All Quality Rails violations resolved. Lint and typecheck both pass with 0 problems. Files modified: 118 components, tests, hooks, and utilities Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -17,7 +17,7 @@ export const authClient = createAuthClient({
|
||||
baseURL:
|
||||
typeof window !== "undefined"
|
||||
? window.location.origin
|
||||
: process.env.BETTER_AUTH_URL || "http://localhost:3042",
|
||||
: (process.env.BETTER_AUTH_URL ?? "http://localhost:3042"),
|
||||
|
||||
// Plugins can be added here when needed
|
||||
plugins: [],
|
||||
@@ -35,11 +35,11 @@ export const { signIn, signOut, useSession, getSession } = authClient;
|
||||
* Uses direct fetch since our server accepts username (not email)
|
||||
* and the default BetterAuth client expects email.
|
||||
*/
|
||||
export async function signInWithCredentials(username: string, password: string) {
|
||||
export async function signInWithCredentials(username: string, password: string): Promise<unknown> {
|
||||
const baseURL =
|
||||
typeof window !== "undefined"
|
||||
? window.location.origin
|
||||
: process.env.BETTER_AUTH_URL || "http://localhost:3042";
|
||||
: (process.env.BETTER_AUTH_URL ?? "http://localhost:3042");
|
||||
|
||||
const response = await fetch(`${baseURL}/api/auth/sign-in/credentials`, {
|
||||
method: "POST",
|
||||
@@ -51,11 +51,11 @@ export async function signInWithCredentials(username: string, password: string)
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
const error = await response.json().catch(() => ({}));
|
||||
throw new Error(error.message || "Authentication failed");
|
||||
const error = (await response.json().catch(() => ({}))) as { message?: string };
|
||||
throw new Error(error.message ?? "Authentication failed");
|
||||
}
|
||||
|
||||
const data = await response.json();
|
||||
const data = (await response.json()) as unknown;
|
||||
return data;
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ export async function signInWithCredentials(username: string, password: string)
|
||||
*/
|
||||
export async function getAccessToken(): Promise<string | null> {
|
||||
const session = await getSession();
|
||||
if (!session?.data?.user) {
|
||||
if (!session.data?.user) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ export async function getAccessToken(): Promise<string | null> {
|
||||
return null;
|
||||
}
|
||||
|
||||
return user.accessToken || null;
|
||||
return user.accessToken ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -91,7 +91,7 @@ export async function getAccessToken(): Promise<string | null> {
|
||||
*/
|
||||
export async function isAdmin(): Promise<boolean> {
|
||||
const session = await getSession();
|
||||
if (!session?.data?.user) {
|
||||
if (!session.data?.user) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user