Merge pull request #3582 from gradido/prepare_biome_fix

fix(other): fix code which lead to biome linting errors
This commit is contained in:
einhornimmond 2025-11-26 14:10:59 +01:00 committed by GitHub
commit aa4bef4a83
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 16 additions and 10 deletions

View File

@ -92,6 +92,7 @@ export class OpenaiClient {
if (openaiThreadEntity.updatedAt < new Date(Date.now() - OPENAI_AI_THREAD_DEFAULT_TIMEOUT_DAYS * 24 * 60 * 60 * 1000)) { if (openaiThreadEntity.updatedAt < new Date(Date.now() - OPENAI_AI_THREAD_DEFAULT_TIMEOUT_DAYS * 24 * 60 * 60 * 1000)) {
logger.info(`Openai thread for user: ${user.id} is older than ${OPENAI_AI_THREAD_DEFAULT_TIMEOUT_DAYS} days, deleting...`) logger.info(`Openai thread for user: ${user.id} is older than ${OPENAI_AI_THREAD_DEFAULT_TIMEOUT_DAYS} days, deleting...`)
// let run async, because it could need some time, but we don't need to wait, because we create a new one nevertheless // let run async, because it could need some time, but we don't need to wait, because we create a new one nevertheless
// biome-ignore lint/complexity/noVoid: start it intentionally async without waiting for result
void this.deleteThread(openaiThreadEntity.id) void this.deleteThread(openaiThreadEntity.id)
return [] return []
} }

View File

@ -73,7 +73,6 @@ let peter: User
let homeCom: DbCommunity let homeCom: DbCommunity
let foreignCom: DbCommunity let foreignCom: DbCommunity
let fedForeignCom: DbFederatedCommunity
describe('send coins', () => { describe('send coins', () => {
beforeAll(async () => { beforeAll(async () => {

View File

@ -18,7 +18,6 @@ export const userFactory = async (
// console.log('call createUser with', JSON.stringify(user, null, 2)) // console.log('call createUser with', JSON.stringify(user, null, 2))
const response = await mutate({ mutation: createUser, variables: user }) const response = await mutate({ mutation: createUser, variables: user })
if (!response?.data?.createUser) { if (!response?.data?.createUser) {
// biome-ignore lint/suspicious/noConsole: will be used in tests where logging is mocked
// console.log(JSON.stringify(response, null, 2)) // console.log(JSON.stringify(response, null, 2))
throw new Error('createUser mutation returned unexpected response') throw new Error('createUser mutation returned unexpected response')
} }

View File

@ -31,6 +31,7 @@ export function validate(schema: ObjectSchema, data: any) {
) )
} }
} catch (e) { } catch (e) {
// biome-ignore lint/suspicious/noConsole: schema validation may be run before logger is initialized
console.error('Error getting description for key ' + key + ': ' + e) console.error('Error getting description for key ' + key + ': ' + e)
throw e throw e
} }

View File

@ -1,4 +1,8 @@
import { TransactionLink as DbTransactionLink, User as DbUser } from "database"; import { TransactionLink as DbTransactionLink, User as DbUser } from 'database'
import { getLogger } from 'log4js'
import { LOG4JS_BASE_CATEGORY_NAME } from '../../config/const'
const logger = getLogger(`${LOG4JS_BASE_CATEGORY_NAME}.graphql.logic.storeLinkAsRedeemed`)
export async function storeLinkAsRedeemed( export async function storeLinkAsRedeemed(
dbTransactionLink: DbTransactionLink, dbTransactionLink: DbTransactionLink,
@ -11,7 +15,7 @@ export async function storeLinkAsRedeemed(
await DbTransactionLink.save(dbTransactionLink) await DbTransactionLink.save(dbTransactionLink)
return true return true
} catch (err) { } catch (err) {
console.error('error in storeLinkAsRedeemed;', err) logger.error('error: ', err)
return false return false
} }
} }

View File

@ -1,3 +1,4 @@
// biome-ignore lint/style/noDefaultExport: Asset modules use default export by convention
declare module '*.jpg' { declare module '*.jpg' {
const value: string const value: string
export default value export default value

View File

@ -58,7 +58,6 @@ describe('communityHandshakes', () => {
communityHandshakeState!.status = CommunityHandshakeStateType.START_OPEN_CONNECTION_CALLBACK communityHandshakeState!.status = CommunityHandshakeStateType.START_OPEN_CONNECTION_CALLBACK
await communityHandshakeState!.save() await communityHandshakeState!.save()
const communityHandshakeState2 = await findPendingCommunityHandshake(publicKey, '1_0') const communityHandshakeState2 = await findPendingCommunityHandshake(publicKey, '1_0')
const states = await DbCommunityHandshakeState.find()
expect(communityHandshakeState2).toBeDefined() expect(communityHandshakeState2).toBeDefined()
expect(communityHandshakeState2).toMatchObject({ expect(communityHandshakeState2).toMatchObject({
publicKey: publicKey.asBuffer(), publicKey: publicKey.asBuffer(),

View File

@ -62,6 +62,7 @@ export class AuthenticationResolver {
// no await to respond immediately and invoke callback-request asynchronously // no await to respond immediately and invoke callback-request asynchronously
// important: startOpenConnectionCallback must catch all exceptions them self, or server will crash! // important: startOpenConnectionCallback must catch all exceptions them self, or server will crash!
// biome-ignore lint/complexity/noVoid: start it intentionally async without waiting for result
void startOpenConnectionCallback(args.handshakeID, argsPublicKey, fedComA) void startOpenConnectionCallback(args.handshakeID, argsPublicKey, fedComA)
methodLogger.debug('openConnection() successfully initiated callback and returns true immediately...') methodLogger.debug('openConnection() successfully initiated callback and returns true immediately...')
return true return true
@ -96,6 +97,7 @@ export class AuthenticationResolver {
`found fedComB and start authentication: ${fedComB.endPoint}${fedComB.apiVersion}`, `found fedComB and start authentication: ${fedComB.endPoint}${fedComB.apiVersion}`,
) )
// no await to respond immediately and invoke authenticate-request asynchronously // no await to respond immediately and invoke authenticate-request asynchronously
// biome-ignore lint/complexity/noVoid: start it intentionally async without waiting for result
void startAuthentication(args.handshakeID, openConnectionCallbackJwtPayload.oneTimeCode, fedComB) void startAuthentication(args.handshakeID, openConnectionCallbackJwtPayload.oneTimeCode, fedComB)
// methodLogger.debug('openConnectionCallback() successfully initiated authentication and returns true immediately...') // methodLogger.debug('openConnectionCallback() successfully initiated authentication and returns true immediately...')
return true return true

View File

@ -1,9 +1,8 @@
import cors from 'cors' import corsLib from 'cors'
const corsOptions = { const corsOptions = {
origin: '*', origin: '*',
exposedHeaders: ['token'], exposedHeaders: ['token'],
} }
// biome-ignore lint/style/noDefaultExport: <explanation> export const cors = corsLib(corsOptions)
export default cors(corsOptions)

View File

@ -4,7 +4,7 @@ import { ApolloServer } from 'apollo-server-express'
import express, { Express } from 'express' import express, { Express } from 'express'
// server // server
import cors from './cors' import { cors } from './cors'
// import serverContext from './context' // import serverContext from './context'
import { plugins } from './plugins' import { plugins } from './plugins'

View File

@ -1,4 +1,3 @@
import { Logger } from 'log4js'
import colors from 'yoctocolors-cjs' import colors from 'yoctocolors-cjs'
export enum ShutdownReason { export enum ShutdownReason {
@ -44,8 +43,10 @@ export function onShutdown(shutdownHandler: (reason: ShutdownReason, error?: Err
} }
export function printServerCrashAsciiArt(msg1: string, msg2: string, msg3: string) { export function printServerCrashAsciiArt(msg1: string, msg2: string, msg3: string) {
// biome-ignore-start lint/suspicious/noConsole: Server Crash Ascii Art is for console and stdout
console.error(colors.redBright(` /\\_/\\ ${msg1}`)) console.error(colors.redBright(` /\\_/\\ ${msg1}`))
console.error(colors.redBright(`( x.x ) ${msg2}`)) console.error(colors.redBright(`( x.x ) ${msg2}`))
console.error(colors.redBright(` > < ${msg3}`)) console.error(colors.redBright(` > < ${msg3}`))
console.error(colors.redBright('')) console.error(colors.redBright(''))
// biome-ignore-end lint/suspicious/noConsole: Server Crash Ascii Art is for console and stdout
} }