diff --git a/front/.eslintrc.cjs b/front/.eslintrc.cjs index 76125b7..514cad1 100644 --- a/front/.eslintrc.cjs +++ b/front/.eslintrc.cjs @@ -32,5 +32,16 @@ module.exports = { } ], 'jsx-quotes': [2, 'prefer-single'], + 'comma-dangle': 'off', + '@typescript-eslint/comma-dangle': ['warn', { + 'arrays': 'always-multiline', + 'objects': 'always-multiline', + 'imports': 'always-multiline', + 'exports': 'always-multiline', + 'functions': 'only-multiline', + 'enums': 'always-multiline', + 'generics': 'always-multiline', + 'tuples': 'always-multiline', + }], }, } diff --git a/front/src/api/announcement/index.ts b/front/src/api/announcement/index.ts index d84eb44..48ea148 100644 --- a/front/src/api/announcement/index.ts +++ b/front/src/api/announcement/index.ts @@ -6,7 +6,7 @@ const processAnnouncement = (data: AnnouncementResponse): Announcement => ({ lng: data.longtitude, bestBy: data.best_by, bookedBy: data.booked_by, - userId: data.user_id + userId: data.user_id, }) export { processAnnouncement } diff --git a/front/src/api/announcement/types.ts b/front/src/api/announcement/types.ts index ea04b23..945477f 100644 --- a/front/src/api/announcement/types.ts +++ b/front/src/api/announcement/types.ts @@ -14,7 +14,7 @@ type AnnouncementResponse = { src: string | null, metro: string, trashId: number | null, - booked_by: number + booked_by: number, } const isAnnouncementResponse = (obj: unknown): obj is AnnouncementResponse => ( @@ -31,7 +31,7 @@ const isAnnouncementResponse = (obj: unknown): obj is AnnouncementResponse => ( 'src': 'string?', 'metro': 'string', 'trashId': 'number?', - 'booked_by': 'number' + 'booked_by': 'number', }) ) @@ -48,7 +48,7 @@ type Announcement = { src: string | null, metro: string, trashId: number | null, - bookedBy: number + bookedBy: number, } export type { diff --git a/front/src/api/announcements/types.ts b/front/src/api/announcements/types.ts index fefd5f2..6c3b89e 100644 --- a/front/src/api/announcements/types.ts +++ b/front/src/api/announcements/types.ts @@ -3,13 +3,13 @@ import { AnnouncementResponse, isAnnouncementResponse } from '../announcement/ty type AnnouncementsResponse = { list_of_announcements: AnnouncementResponse[], - Success: boolean + Success: boolean, } const isAnnouncementsResponse = (obj: unknown): obj is AnnouncementsResponse => ( isObject(obj, { 'list_of_announcements': obj => isArrayOf(obj, isAnnouncementResponse), - 'Success': 'boolean' + 'Success': 'boolean', }) ) diff --git a/front/src/api/book/types.ts b/front/src/api/book/types.ts index 8e7c134..c2226e6 100644 --- a/front/src/api/book/types.ts +++ b/front/src/api/book/types.ts @@ -1,12 +1,12 @@ import { isObject } from '../../utils/types' type BookResponse = { - Success: boolean + Success: boolean, } const isBookResponse = (obj: unknown): obj is BookResponse => ( isObject(obj, { - 'Success': 'boolean' + 'Success': 'boolean', }) ) diff --git a/front/src/api/osmAddress/types.ts b/front/src/api/osmAddress/types.ts index 88ba31b..2013e52 100644 --- a/front/src/api/osmAddress/types.ts +++ b/front/src/api/osmAddress/types.ts @@ -1,7 +1,7 @@ import { isObject } from '../../utils/types' type OsmAddressResponse = { - display_name: string + display_name: string, } const isOsmAddressResponse = (obj: unknown): obj is OsmAddressResponse => ( diff --git a/front/src/api/putAnnouncement/types.ts b/front/src/api/putAnnouncement/types.ts index 420f8a4..9339351 100644 --- a/front/src/api/putAnnouncement/types.ts +++ b/front/src/api/putAnnouncement/types.ts @@ -1,12 +1,12 @@ import { isObject } from '../../utils/types' type PutAnnouncementResponse = { - Answer: boolean + Answer: boolean, } const isPutAnnouncementResponse = (obj: unknown): obj is PutAnnouncementResponse => ( isObject(obj, { - 'Answer': 'boolean' + 'Answer': 'boolean', }) ) diff --git a/front/src/api/removeAnnouncement/types.ts b/front/src/api/removeAnnouncement/types.ts index 0c5bb2b..016379a 100644 --- a/front/src/api/removeAnnouncement/types.ts +++ b/front/src/api/removeAnnouncement/types.ts @@ -1,12 +1,12 @@ import { isObject } from '../../utils/types' type RemoveAnnouncementResponse = { - Answer: boolean + Answer: boolean, } const isRemoveAnnouncementResponse = (obj: unknown): obj is RemoveAnnouncementResponse => ( isObject(obj, { - 'Answer': 'boolean' + 'Answer': 'boolean', }) ) diff --git a/front/src/api/signup/types.ts b/front/src/api/signup/types.ts index 0246617..cd22da8 100644 --- a/front/src/api/signup/types.ts +++ b/front/src/api/signup/types.ts @@ -11,7 +11,7 @@ type SignUpResponse = { Success: true, } | { Success: false, - Message: string + Message: string, } const isSignUpResponse = (obj: unknown): obj is SignUpResponse => ( diff --git a/front/src/api/token/types.ts b/front/src/api/token/types.ts index cb95c7c..343f511 100644 --- a/front/src/api/token/types.ts +++ b/front/src/api/token/types.ts @@ -1,12 +1,12 @@ import { isObject } from '../../utils/types' type TokenResponse = { - access_token: string + access_token: string, } const isTokenResponse = (obj: unknown): obj is TokenResponse => ( isObject(obj, { - 'access_token': 'string' + 'access_token': 'string', }) ) diff --git a/front/src/api/trashbox/index.ts b/front/src/api/trashbox/index.ts index 0632a48..311987a 100644 --- a/front/src/api/trashbox/index.ts +++ b/front/src/api/trashbox/index.ts @@ -6,11 +6,12 @@ import { Trashbox, TrashboxResponse } from './types' const composeTrashboxURL = (position: LatLng) => ( API_URL + '/trashbox?' + new URLSearchParams({ lat: position.lat.toString(), - lng: position.lng.toString() + lng: position.lng.toString(), }).toString() ) -const processTrashbox = (data: TrashboxResponse): Trashbox[] => +const processTrashbox = (data: TrashboxResponse): Trashbox[] => ( data +) export { composeTrashboxURL, processTrashbox } diff --git a/front/src/api/trashbox/types.ts b/front/src/api/trashbox/types.ts index b2a17c0..9d9461b 100644 --- a/front/src/api/trashbox/types.ts +++ b/front/src/api/trashbox/types.ts @@ -4,7 +4,7 @@ type Trashbox = { Lat: number, Lng: number, Address: string, - Categories: string[] + Categories: string[], } const isTrashbox = (obj: unknown): obj is Trashbox => ( @@ -12,7 +12,7 @@ const isTrashbox = (obj: unknown): obj is Trashbox => ( 'Lat': 'number', 'Lng': 'number', 'Address': 'string', - 'Categories': obj => isArrayOf(obj, isString) + 'Categories': obj => isArrayOf(obj, isString), }) ) diff --git a/front/src/api/user/index.ts b/front/src/api/user/index.ts index 34584cd..7354125 100644 --- a/front/src/api/user/index.ts +++ b/front/src/api/user/index.ts @@ -10,10 +10,10 @@ const initialUser: User = import.meta.env.DEV ? { // Temporary, until api is rea regDate: faker.date.anytime().getTime(), points: Math.round(Math.random() * 1000), } : { - id: -1, - name: '', + id: 1, + name: 'Вася пупкин', regDate: 0, - points: 0, + points: 100, } const composeUserURL = () => ( diff --git a/front/src/api/user/types.ts b/front/src/api/user/types.ts index 4f5d989..ba96548 100644 --- a/front/src/api/user/types.ts +++ b/front/src/api/user/types.ts @@ -4,7 +4,7 @@ type User = { id: number, name: string, regDate: number, - points: number + points: number, } const isUser = (obj: unknown): obj is User => ( diff --git a/front/src/assets/addIcon.svg b/front/src/assets/addIcon.svg index a6ae317..3925975 100644 --- a/front/src/assets/addIcon.svg +++ b/front/src/assets/addIcon.svg @@ -1 +1,3 @@ - \ No newline at end of file + + + diff --git a/front/src/assets/filterIcon.svg b/front/src/assets/filterIcon.svg index cd0e442..a9443e5 100644 --- a/front/src/assets/filterIcon.svg +++ b/front/src/assets/filterIcon.svg @@ -1 +1,3 @@ - \ No newline at end of file + + + \ No newline at end of file diff --git a/front/src/assets/handIcon.svg b/front/src/assets/handIcon.svg index d535741..673ab9a 100644 --- a/front/src/assets/handIcon.svg +++ b/front/src/assets/handIcon.svg @@ -1 +1,3 @@ - \ No newline at end of file + + + diff --git a/front/src/assets/handStars.svg b/front/src/assets/handStars.svg index e14b406..d172f1b 100644 --- a/front/src/assets/handStars.svg +++ b/front/src/assets/handStars.svg @@ -1,7 +1,7 @@ - - - - + + + + diff --git a/front/src/assets/metro.ts b/front/src/assets/metro.ts index 76168a5..940713e 100644 --- a/front/src/assets/metro.ts +++ b/front/src/assets/metro.ts @@ -21,7 +21,7 @@ const stations: Record> = { 'Кировский завод', 'Автово', 'Ленинский проспект', - 'Проспект Ветеранов' + 'Проспект Ветеранов', ]), blue: new Set([ 'Парнас', @@ -41,7 +41,7 @@ const stations: Record> = { 'Парк Победы', 'Московская', 'Звёздная', - 'Купчино' + 'Купчино', ]), green: new Set([ 'Приморская', @@ -54,7 +54,7 @@ const stations: Record> = { 'Ломоносовская', 'Пролетарская', 'Обухово', - 'Рыбацкое' + 'Рыбацкое', ]), orange: new Set([ 'Спасская', @@ -64,7 +64,7 @@ const stations: Record> = { 'Новочеркасская', 'Ладожская', 'Проспект Большевиков', - 'Улица Дыбенко' + 'Улица Дыбенко', ]), violet: new Set([ 'Комендантский проспект', @@ -81,7 +81,7 @@ const stations: Record> = { 'Международная', 'Проспект славы', 'Дунайскай', - 'Шушары' + 'Шушары', ]), } diff --git a/front/src/assets/puff.svg b/front/src/assets/puff.svg index d598440..b50002d 100644 --- a/front/src/assets/puff.svg +++ b/front/src/assets/puff.svg @@ -10,4 +10,4 @@ - \ No newline at end of file + diff --git a/front/src/assets/signOut.svg b/front/src/assets/signOut.svg index fdaeff6..0bb8512 100644 --- a/front/src/assets/signOut.svg +++ b/front/src/assets/signOut.svg @@ -1,4 +1,4 @@ - - \ No newline at end of file + + diff --git a/front/src/assets/userIcon.svg b/front/src/assets/userIcon.svg index e2a4590..2139409 100644 --- a/front/src/assets/userIcon.svg +++ b/front/src/assets/userIcon.svg @@ -1 +1,3 @@ - \ No newline at end of file + + + diff --git a/front/src/components/AnnouncementDetails.tsx b/front/src/components/AnnouncementDetails.tsx index b3947ca..86c62aa 100644 --- a/front/src/components/AnnouncementDetails.tsx +++ b/front/src/components/AnnouncementDetails.tsx @@ -28,7 +28,7 @@ const styles = { } function AnnouncementDetails({ close, refresh, announcement: { - id, name, category, bestBy, description, lat, lng, address, metro, bookedBy, userId + id, name, category, bestBy, description, lat, lng, address, metro, bookedBy, userId, } }: AnnouncementDetailsProps) { const { handleBook, bookButton } = useBook() diff --git a/front/src/components/AuthForm.tsx b/front/src/components/AuthForm.tsx index 52c4f47..8cb45ea 100644 --- a/front/src/components/AuthForm.tsx +++ b/front/src/components/AuthForm.tsx @@ -6,7 +6,7 @@ import { composeSignUpBody } from '../api/signup' import { composeSignInBody } from '../api/token' type AuthFormProps = { - register: boolean + register: boolean, goBack: () => void, } diff --git a/front/src/components/BackHeader.tsx b/front/src/components/BackHeader.tsx index 6fb0484..4616d35 100644 --- a/front/src/components/BackHeader.tsx +++ b/front/src/components/BackHeader.tsx @@ -5,7 +5,7 @@ import { PropsWithChildren } from 'react' import BackButton from '../assets/backArrow.svg' type BackHeaderProps = { - text: string + text: string, } function BackHeader({ text, children }: PropsWithChildren) { diff --git a/front/src/components/BottomNavBar.tsx b/front/src/components/BottomNavBar.tsx index e164dc8..567d0e7 100644 --- a/front/src/components/BottomNavBar.tsx +++ b/front/src/components/BottomNavBar.tsx @@ -15,22 +15,20 @@ const styles = { display: 'flex', flexDirection: 'row', height: '100%', - margin: 'auto' + margin: 'auto', } as CSSProperties, navBarElement: { width: '100%', height: '100%', display: 'flex', alignItems: 'center', - justifyContent: 'center' + justifyContent: 'center', } as CSSProperties, } - - type BottomNavBarProps = { width: number, - toggleFilters: (p: boolean) => void + toggleFilters: (state: boolean) => void, } function BottomNavBar({ width, toggleFilters }: BottomNavBarProps) { @@ -38,7 +36,7 @@ function BottomNavBar({ width, toggleFilters }: BottomNavBarProps) {
- toggleFilters(true)}> + toggleFilters(true)}> Фильтровать объявления @@ -46,7 +44,7 @@ function BottomNavBar({ width, toggleFilters }: BottomNavBarProps) { Опубликовать объявление - + Личный кабинет diff --git a/front/src/components/CardLayout.tsx b/front/src/components/CardLayout.tsx index 588e780..0c163b8 100644 --- a/front/src/components/CardLayout.tsx +++ b/front/src/components/CardLayout.tsx @@ -4,7 +4,7 @@ import { Card } from 'react-bootstrap' import { BackHeader } from '.' type CardLayoutProps = { - text: string + text: string, } const CardLayout = ({ text, children }: PropsWithChildren) => ( diff --git a/front/src/components/CategoryPreview.tsx b/front/src/components/CategoryPreview.tsx index caaecd7..d72cb94 100644 --- a/front/src/components/CategoryPreview.tsx +++ b/front/src/components/CategoryPreview.tsx @@ -4,7 +4,7 @@ import { useAnnouncements } from '../hooks/api' import { gotError } from '../hooks/useFetch' type CategoryPreviewProps = { - category: UserCategory + category: UserCategory, } function CategoryPreview({ category }: CategoryPreviewProps) { diff --git a/front/src/components/Filters.tsx b/front/src/components/Filters.tsx index e0e3619..4c094a5 100644 --- a/front/src/components/Filters.tsx +++ b/front/src/components/Filters.tsx @@ -10,21 +10,21 @@ type FiltersProps = { filter: FiltersType, setFilter: SetState, filterShown: boolean, - setFilterShown: SetState + setFilterShown: SetState, } function Filters({ filter, setFilter, filterShown, setFilterShown }: FiltersProps) { const handleSubmit: FormEventHandler = (event) => { - event.preventDefault(); - event.stopPropagation(); + event.preventDefault() + event.stopPropagation() const formData = new FormData(event.currentTarget) setFilter(prev => ({ ...prev, category: (formData.get('category') as (FiltersType['category'] | null)) || undefined, - metro: (formData.get('metro') as (FiltersType['metro'] | null)) || undefined + metro: (formData.get('metro') as (FiltersType['metro'] | null)) || undefined, })) setFilterShown(false) diff --git a/front/src/components/LineDot.tsx b/front/src/components/LineDot.tsx index a3f16de..66b5ad7 100644 --- a/front/src/components/LineDot.tsx +++ b/front/src/components/LineDot.tsx @@ -3,8 +3,9 @@ import { colors, lineNames, lineByName } from '../assets/metro' function LineDot({ station }: { station: string }) { const line = lineByName(station) - if (line == undefined) + if (line == undefined) { return <> + } const lineTitle = lineNames[line] const color = colors[line] diff --git a/front/src/components/LocationMarker.tsx b/front/src/components/LocationMarker.tsx index b4a1db5..f49149b 100644 --- a/front/src/components/LocationMarker.tsx +++ b/front/src/components/LocationMarker.tsx @@ -7,7 +7,7 @@ import { iconItem } from '../utils/markerIcons' type LocationMarkerProps = { address: string, position: LatLng, - setPosition: SetState + setPosition: SetState, } function LocationMarker({ address, position, setPosition }: LocationMarkerProps) { @@ -21,7 +21,7 @@ function LocationMarker({ address, position, setPosition }: LocationMarkerProps) }, resize: () => { setPosition(map.getCenter()) - } + }, }) return ( diff --git a/front/src/components/Points.tsx b/front/src/components/Points.tsx index 184d876..760524a 100644 --- a/front/src/components/Points.tsx +++ b/front/src/components/Points.tsx @@ -3,7 +3,7 @@ import { CSSProperties } from 'react' import handStarsIcon from '../assets/handStars.svg' type PointsProps = { - points: number + points: number, } const styles = { diff --git a/front/src/components/SignOut.tsx b/front/src/components/SignOut.tsx index 9e01c3c..95cc234 100644 --- a/front/src/components/SignOut.tsx +++ b/front/src/components/SignOut.tsx @@ -9,7 +9,7 @@ import signOutIcon from '../assets/signOut.svg' const styles = { rightIcon: { marginLeft: '1rem', - marginRight: 0 + marginRight: 0, } as CSSProperties, } diff --git a/front/src/components/StoriesPreview.tsx b/front/src/components/StoriesPreview.tsx index 3a88507..306b71a 100644 --- a/front/src/components/StoriesPreview.tsx +++ b/front/src/components/StoriesPreview.tsx @@ -58,7 +58,7 @@ const styles = { } as CSSProperties, leftScrollButton: { left: 0, - transform: 'scaleX(-1)' + transform: 'scaleX(-1)', } as CSSProperties, rightScrollButton: { right: 0, @@ -116,7 +116,7 @@ function StoriesPreview({ announcements, category }: StoriesPreviewProps) {
  • {ann.src?.endsWith('mp4') ? (