Skip to content
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

fix(common): yarn check #184

Merged
merged 21 commits into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 0 additions & 30 deletions blog/app/sentry.client.config.js

This file was deleted.

16 changes: 0 additions & 16 deletions blog/app/sentry.edge.config.js

This file was deleted.

15 changes: 0 additions & 15 deletions blog/app/sentry.server.config.js

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export const AllArticles: FC<AllArticlesProps> = memo(({
>
{postsData.map(({ uri, title, date, excerpt, featuredImage }) => (
<Article
key={`post-data-${title}`}
uri={uri}
title={title}
date={date}
Expand Down
7 changes: 2 additions & 5 deletions blog/pages/index-page/src/index-page.client.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// TODO move it directive to fragment level

'use client'

import type { FC } from 'react'
Expand All @@ -22,7 +20,6 @@ import { getServicesData } from '@globals/data'

export const IndexPageClient: FC<IndexPageProps> = () => {
const { contacts } = getContactsData()
// TODO ошибка тут
const { posts } = getBlogPostsData()
const { navigation } = getNavigationData()
const { availableRadii } = getAvailableRadiiData()
Expand All @@ -42,9 +39,9 @@ export const IndexPageClient: FC<IndexPageProps> = () => {
servicesData={services}
/>
<AllArticles
// @ts-expect-error undefined
// @ts-expect-error undefined not assignable
fragmentsData={fragments}
// @ts-expect-error not assignable
// @ts-expect-error undefined not assignable
postsData={posts}
/>
<Footer
Expand Down
2 changes: 0 additions & 2 deletions blog/pages/post-page/src/post-page.client.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint-disable */

'use client'

import type { FC } from 'react'
Expand Down
2 changes: 0 additions & 2 deletions blog/pages/post-page/src/post-page.component.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint-disable */

import type { PostPageProps } from './post-page.interfaces.js'

import React from 'react'
Expand Down
8 changes: 5 additions & 3 deletions blog/pages/post-page/src/post-page.style.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { Global } from '@emotion/react'
import { css } from '@emotion/react'
import React from 'react'
import type { JSX } from 'react'

import { Global } from '@emotion/react'
import { css } from '@emotion/react'
import React from 'react'

export const PostPageStyles = (): JSX.Element => (
<Global
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type { client } from '../client/index.js'
export type GetTitlesFunctionType = () => Promise<Array<string>>

interface ApolloAdapterInt {
runQuery: (query: QueryType) => Promise<ReturnType<typeof client.query<any>>>
runQuery: (query: QueryType) => Promise<ReturnType<typeof client.query<QueryType>>>
}

type QueryType = ReturnType<typeof gql>
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from './apollo-adapter.interfaces.js'
export type * from './apollo-adapter.interfaces.js'
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { client } from '../client/index.js'

@Injectable()
export class ApolloAdapterService implements ApolloAdapterInt {
async runQuery(query: QueryType): Promise<ReturnType<typeof client.query<any>>> {
async runQuery(query: QueryType): Promise<ReturnType<typeof client.query<QueryType>>> {
return client.query({ query })
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import type { ArrayElement } from '@globals/data'

import type { ReturnDataType } from '../interfaces/index.js'
import type { ReturnTitlesType } from '../interfaces/index.js'

Expand All @@ -14,12 +16,14 @@ class GetCarBodyTitlesService {

async process(): ReturnTitlesType {
const carBodiesData = await this.getCarBodiesData()
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return carBodiesData.map((singleCarData: any) => singleCarData.contentAddons.title)
return carBodiesData.map(
(singleCarData: ArrayElement<typeof carBodiesData>) => singleCarData.contentAddons.title
)
}

private async getCarBodiesData(): ReturnDataType {
const queryData = await this.apolloAdapterService.runQuery(GET_CAR_BODIES)
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const queryData = (await this.apolloAdapterService.runQuery(GET_CAR_BODIES)) as any
const carBodiesQueryData: Awaited<ReturnDataType> = queryData.data.carBodyItems
.nodes as Awaited<ReturnDataType>
checkArrayLength({ carBodiesQueryData })
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import type { ArrayElement } from '@globals/data'

import type { ReturnDataType } from '../interfaces/index.js'
import type { ReturnTitlesType } from '../interfaces/index.js'

Expand All @@ -14,12 +16,14 @@ class GetRadiiTitlesService {

async process(): ReturnTitlesType {
const radiiData = await this.getRadiiData()
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return radiiData.map((singleRadiiData: any) => singleRadiiData.contentAddons.title)
return radiiData.map(
(singleRadiiData: ArrayElement<typeof radiiData>) => singleRadiiData.contentAddons.title
)
}

private async getRadiiData(): ReturnDataType {
const queryData = await this.apolloAdapterService.runQuery(GET_AVAILABLE_RADII)
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const queryData = (await this.apolloAdapterService.runQuery(GET_AVAILABLE_RADII)) as any
const radiiQueryData: Awaited<ReturnDataType> = queryData.data.availableRadiusItems
.nodes as Awaited<ReturnDataType>
checkArrayLength({ radiiQueryData })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ class GetServiceTitlesService {
}

private async getServicesData(): ReturnServicesDataType {
const queryData = await this.apolloAdapterService.runQuery(GET_SERVICES)
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const queryData = (await this.apolloAdapterService.runQuery(GET_SERVICES)) as any
const servicesQueryData = queryData.data.services.nodes
checkArrayLength({ servicesQueryData })
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ class GetWorkTimeRawStringService {
}

private async getWorkTimeQueryData(): ReturnWorkTimeDataType {
const queryData = await this.apolloAdapterService.runQuery(GET_CONTACTS)
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const queryData = (await this.apolloAdapterService.runQuery(GET_CONTACTS)) as any
const workTimeData: Awaited<ReturnWorkTimeDataType> = queryData.data.contactItems
.nodes as Awaited<ReturnWorkTimeDataType>
return workTimeData
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { MikroORM } from '@mikro-orm/core'
import type { Options } from '@mikro-orm/postgresql'
import type { DynamicModule } from '@nestjs/common'
import type { OnModuleInit } from '@nestjs/common'
import type { Provider } from '@nestjs/common'

import { MikroORM } from '@mikro-orm/core'
import { MikroOrmModule } from '@mikro-orm/nestjs'
import { Module } from '@nestjs/common'
import { ModuleRef } from '@nestjs/core'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import type { Options } from 'tgsnake'

const TGSHAKE_CONFIG: Options = {
apiHash: process.env.BOOKING_BOT_API_HASH!,
apiId: Number(process.env.BOOKING_BOT_API_ID!),
apiHash: process.env.BOOKING_BOT_API_HASH as unknown as string,
apiId: Number(process.env.BOOKING_BOT_API_ID),
logLevel: 'error',
plugins: [],
clientOptions: {},
login: {
sessionName: 'myapp',
forceDotSession: true,
botToken: process.env.BOOKING_BOT_BOT_TOKEN!,
botToken: process.env.BOOKING_BOT_BOT_TOKEN,
},
experimental: {},
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import type { TelegramBotFormattedContextKeyType } from '@booking-telegram-bot/tgsnake-adapter'
import type { TgsnakeContextType } from '@booking-telegram-bot/tgsnake-adapter'
import type { TelegramBotFormattedContextType } from '@booking-telegram-bot/tgsnake-adapter'
import type { TgsnakeContextType } from '@booking-telegram-bot/tgsnake-adapter'
import type { TelegramBotFormattedContextType } from '@booking-telegram-bot/tgsnake-adapter'

import { checkFormattedContextHelper } from '../helpers/index.js'
import { checkFormattedContextHelper } from '../helpers/index.js'

const getFormattedContextGetter = (ctx: TgsnakeContextType): TelegramBotFormattedContextType => {
const formattedContext: Record<TelegramBotFormattedContextKeyType, any> = {
const formattedContext = {
userId: ctx.message?.from?.id,
userFirstName: ctx.message?.from?.firstname,
userLastName: ctx.message?.from?.lastname,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import type { TelegramBotFormattedContextKeyType } from '../interfaces/index.js'
import { CheckFormattedContextHelperError } from '../errors/index.js'

const checkFormattedContextHelper = (
// eslint-disable-next-line @typescript-eslint/no-explicit-any
formattedContext: Record<TelegramBotFormattedContextKeyType, any>
): TelegramBotFormattedContextType => {
const formattedContextKeys = Object.keys(formattedContext)
Expand Down
2 changes: 1 addition & 1 deletion booking-telegram-bot/adapters/tgsnake-adapter/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export * from './module/index.js'
export * from './interfaces/index.js'
export type * from './interfaces/index.js'
export * from './services/index.js'
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from './tgsnake.interfaces.js'
export type * from './tgsnake.interfaces.js'
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* eslint-disable @typescript-eslint/sort-type-constituents */

import type { Composer } from 'tgsnake'
import type { Conversation } from 'tgsnake/lib/src/Conversation/conversation.js'
import type { TypeUpdate } from 'tgsnake/lib/src/TL/Updates/Update.js'
Expand Down Expand Up @@ -27,7 +29,7 @@ type OnMessageReturnType = Composer
type OnCommandReturnType = Composer

type CreateConversationReturnType = {
data: Record<string, any>
data: Record<string, boolean | string | object>
waitMessage: (callback: WaitMessageCallbackType) => WaitMessageType
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class CheckChatConversationService {

process(chatId: bigint): boolean {
const { conversation } = this.tgsnakeAdapterService.conversation as unknown as {
conversation: Map<bigint, any>
conversation: Map<bigint, object>
}

if (conversation.get(chatId)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { BookingDataKeyType } from '../interfaces/index.js'

import { CheckBookingDataHelperError } from '../errors/index.js'

const checkBookingDataHelper = (body: Record<string, any>): BookingDataType => {
const checkBookingDataHelper = (body: Record<string, unknown>): BookingDataType => {
const bodyKeys = Object.keys(body)
for (const bodyKey of bodyKeys) {
if (!body[bodyKey as BookingDataKeyType]) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from './booking-data.interface.js'
export type * from './booking-data.interface.js'
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export class WriteBookingDataUseCase {

async process(body: Body): Promise<number> {
if (typeof body === 'string') {
const parsedBody: Record<string, any> = await JSON.parse(body)
const parsedBody = (await JSON.parse(body)) as Record<string, unknown>
const checkedBody = checkBookingDataHelper(parsedBody)
await this.appointmentEntityRepository.writeData(checkedBody)
return HttpStatus.OK
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export class BookingController {
async writeData(@Body() body: Body): Promise<number> {
try {
return await this.writeBookingDataUseCase.process(body)
} catch (error) {
} catch {
throw new InternalServerError()
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from './booking-data.interface.js'
export type * from './booking-data.interface.js'
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const getFormattedAppointmentData: GetFormattedAppointmentDataType = (
telegramFullName
) => {
const { carBody, radii, service, commentary } = rawAppointmentData
const timeSlotStart = BigInt(rawAppointmentData.timeSlot.milliseconds as number)
const timeSlotStart = BigInt(rawAppointmentData.timeSlot.milliseconds)
const timeSlotEnd = BigInt(Number(rawAppointmentData.timeSlot.milliseconds) + TIME_SLOT_STEP_MS)

return {
Expand All @@ -20,7 +20,7 @@ const getFormattedAppointmentData: GetFormattedAppointmentDataType = (
radii,
isApproved: false,
service,
commentary,
commentary: typeof commentary === 'string' ? commentary : null,
}
}
export { getFormattedAppointmentData }
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
import type { OrmAppointmentDataType } from '@telegram-bot/application-module/interfaces'

type GetFormattedAppointmentDataType = (
rawAppointmentData: Record<string, any>,
rawAppointmentData: {
carBody: string
radii: string
service: string
commentary: boolean | string
timeSlot: {
milliseconds: number
}
},
telegramUserId: bigint,
telegramFullName: string
) => OrmAppointmentDataType
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export * from './telegram-client.interfaces.js'
export * from './orm.interface.js'
export type * from './orm.interface.js'
export type * from './appointment-conversation.interfaces.js'
export type * from './telegram-client.interfaces.js'

export * from './question-answer-pair.abstract-class.js'
export * from './appointment-conversation.interfaces.js'
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ type OrmAppointmentDataType = {
carBody: string
radii: string
service: string
commentary?: string
commentary: string | null
}

export type { OrmAppointmentDataType }
Loading
Loading