mirror of
https://github.com/johndoe6345789/metabuilder.git
synced 2026-04-24 13:54:57 +00:00
Fix additional ESLint warnings and auto-fix issues (56 total warnings fixed)
Co-authored-by: johndoe6345789 <224850594+johndoe6345789@users.noreply.github.com>
This commit is contained in:
@@ -27,7 +27,7 @@ interface TenantLayoutProps {
|
||||
*/
|
||||
async function getPackageDependencies(packageId: string): Promise<{ id: string; name?: string }[]> {
|
||||
const metadata = await loadPackageMetadata(packageId) as { dependencies?: string[]; name?: string; minLevel?: number } | null
|
||||
if (metadata === null || metadata.dependencies === undefined || metadata.dependencies.length === 0) {
|
||||
if (metadata?.dependencies === undefined || metadata.dependencies.length === 0) {
|
||||
return []
|
||||
}
|
||||
|
||||
|
||||
@@ -125,10 +125,10 @@ async function handleRequest(
|
||||
if (!result.success) {
|
||||
// Map common errors to appropriate status codes
|
||||
const errorMsg = result.error ?? 'Operation failed'
|
||||
if (errorMsg !== null && errorMsg !== undefined && errorMsg.includes('not found')) {
|
||||
if (errorMsg?.includes('not found') === true) {
|
||||
return errorResponse(errorMsg, STATUS.NOT_FOUND)
|
||||
}
|
||||
if (errorMsg !== null && errorMsg !== undefined && errorMsg.includes('required')) {
|
||||
if (errorMsg?.includes('required') === true) {
|
||||
return errorResponse(errorMsg, STATUS.BAD_REQUEST)
|
||||
}
|
||||
return errorResponse(errorMsg, STATUS.INTERNAL_ERROR)
|
||||
|
||||
@@ -38,11 +38,9 @@ export class AuthStore {
|
||||
}
|
||||
|
||||
async ensureSessionChecked(): Promise<void> {
|
||||
if (this.sessionCheckPromise === null) {
|
||||
this.sessionCheckPromise = this.refresh().finally(() => {
|
||||
this.sessionCheckPromise = null
|
||||
})
|
||||
}
|
||||
this.sessionCheckPromise ??= this.refresh().finally(() => {
|
||||
this.sessionCheckPromise = null
|
||||
})
|
||||
return this.sessionCheckPromise
|
||||
}
|
||||
|
||||
@@ -110,7 +108,7 @@ export class AuthStore {
|
||||
|
||||
try {
|
||||
const user = await fetchSession()
|
||||
if (user) {
|
||||
if (user !== null && user !== undefined) {
|
||||
this.setState({
|
||||
user: mapUserToAuthUser(user),
|
||||
isAuthenticated: true,
|
||||
|
||||
@@ -18,9 +18,9 @@ export const mapUserToAuthUser = (user: User): AuthUser => {
|
||||
username: user.username,
|
||||
role: user.role as AuthUser['role'],
|
||||
level: getRoleLevel(user.role),
|
||||
tenantId: user.tenantId || undefined,
|
||||
profilePicture: user.profilePicture || undefined,
|
||||
bio: user.bio || undefined,
|
||||
tenantId: (user.tenantId !== null && user.tenantId.length > 0) ? user.tenantId : undefined,
|
||||
profilePicture: user.profilePicture ?? undefined,
|
||||
bio: user.bio ?? undefined,
|
||||
isInstanceOwner: user.isInstanceOwner,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -275,7 +275,7 @@ function evaluateSimpleExpression(expr: string, context: RenderContext): JsonVal
|
||||
if (value !== null && value !== undefined && typeof value === 'object' && !Array.isArray(value)) {
|
||||
value = (value as Record<string, JsonValue>)[innerPart]
|
||||
}
|
||||
return !value
|
||||
return value === null || value === undefined || value === false || value === 0 || value === '' ? true : false
|
||||
}
|
||||
|
||||
// Handle array access or simple property
|
||||
|
||||
Reference in New Issue
Block a user