refactor(eslint): remove any types

pull/96/head
Andrei Dekterev 3 years ago
parent 0e68373893
commit 6b19ad2ec3
  1. 1
      src/components/ItemInfo/ItemInfo.tsx
  2. 1
      src/config/clients/types.tsx
  3. 1
      src/config/index.tsx
  4. 2
      src/config/queries.tsx
  5. 1
      src/features/AirPlay/index.tsx
  6. 1
      src/features/ChromeCast/index.tsx
  7. 1
      src/features/Combobox/helpers/index.tsx
  8. 2
      src/features/HeaderFilters/store/hooks/index.tsx
  9. 5
      src/features/Icon/index.tsx
  10. 9
      src/features/MatchCard/CardFrontside/MatchCardMobile/index.tsx
  11. 4
      src/features/MatchCard/CardFrontside/index.tsx
  12. 17
      src/features/MatchPage/components/FavouriteTeam/hooks.tsx
  13. 10
      src/features/MatchPage/components/MatchDescription/index.tsx
  14. 5
      src/features/MatchesGrid/index.tsx
  15. 1
      src/features/MultiSourcePlayer/components/ProgressBar/hooks.tsx
  16. 2
      src/features/Name/index.tsx
  17. 2
      src/features/SportsFilter/components/SelectSportPopup/index.tsx
  18. 1
      src/features/StreamPlayer/components/ProgressBar/hooks.tsx
  19. 2
      src/features/StreamPlayer/hooks/useSlider.tsx
  20. 8
      src/features/UserAccount/components/PageSubscriptions/hooks.tsx
  21. 1
      src/helpers/callApi/types.tsx
  22. 1
      src/hooks/useEventListener.tsx
  23. 29
      src/hooks/useLocalStorage.tsx
  24. 2
      src/hooks/useObjectState.tsx
  25. 1
      src/hooks/useRequest.tsx
  26. 1
      src/hooks/useStorage/index.tsx
  27. 4
      src/pages/HighlightsPage/components/FormHighlights/hooks.tsx
  28. 2
      src/requests/getSound.tsx
  29. 1
      src/requests/getSounds.tsx
  30. 2
      src/requests/getUserSubscribes.tsx
  31. 1
      src/requests/index.tsx

@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import {
ProfileTypes,
PROFILE_NAMES,

@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { css } from 'styled-components/macro'
type ProcedureName = string

@ -10,3 +10,4 @@ export * from './currencies'
export * from './dashes'
export * from './env'
export * from './userAgent'
export * from './queries'

@ -1,4 +1,4 @@
export const querieKeys = {
matchScore: 'matchScore',
liveMatchScores: 'liveMatchScores',
matchScore: 'matchScore',
}

@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { useEffect } from 'react'
import includes from 'lodash/includes'

@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import {
Fragment,
memo,

@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import startsWith from 'lodash/startsWith'
import orderBy from 'lodash/orderBy'
import toLower from 'lodash/toLower'

@ -34,7 +34,7 @@ export const useFilters = () => {
const [selectedFilters, setSelectedFilters] = useState<Array<string>>([])
const [isShowTournament, setIsShowTournament] = useState(true)
const [selectTournament, setSelectTournament] = useState<TournamentType>()
const [sportIds, setSportIds] = useState<any>()
const [sportIds, setSportIds] = useState<Array<number>>([])
const isTodaySelected = isToday(selectedDate)
const compareSport = useCallback((match: Match, sportNames: Array<string>) => {

@ -1,4 +1,5 @@
import React from 'react'
/* eslint-disable @typescript-eslint/no-explicit-any */
import React, { CSSProperties } from 'react'
import * as icons from '../../libs/index'
export type IconProps = {
@ -8,7 +9,7 @@ export type IconProps = {
onClick?: () => void,
refIcon: any,
size?: number | string,
styles?: any,
styles?: CSSProperties,
}
export const Icon: React.FC<IconProps> = ({

@ -12,8 +12,11 @@ import { useName } from 'features/Name'
import { T9n } from 'features/T9n'
import { MatchAccess } from 'features/Matches/helpers/getMatchClickAction'
import { useUserFavoritesStore } from 'features/UserFavorites/store'
import { getCardColor } from 'helpers/getCardColor'
import type { LiveScore } from 'requests'
import { NoAccessMessage } from '../../NoAccessMessage'
import { getPrepareTimeFormat } from '../../helpers'
import { getPrepareDateFormat } from '../../helpers/getPrepareDateFormat'
@ -50,6 +53,7 @@ type Props = {
match: Match,
onClick: () => void,
onKeyPress: (e: KeyboardEvent<HTMLLIElement>) => void,
score?: LiveScore,
}
export const CardFrontsideMobile = ({
@ -58,6 +62,7 @@ export const CardFrontsideMobile = ({
match,
onClick,
onKeyPress,
score,
}: Props) => {
const location = useLocation()
const {
@ -150,14 +155,14 @@ export const CardFrontsideMobile = ({
<TeamName nameObj={team1} />
{team1InFavorites && <FavoriteSign />}
</NameSignWrapper>
{showScore && <Score>{team1.score}</Score>}
{showScore && <Score>{score?.team1.score ?? team1.score}</Score>}
</Team>
<Team>
<NameSignWrapper>
<TeamName nameObj={team2} />
{team2InFavorites && <FavoriteSign />}
</NameSignWrapper>
{showScore && <Score>{team2.score}</Score>}
{showScore && <Score>{score?.team2.score ?? team2.score}</Score>}
</Team>
</Teams>
<SecondaryInfo>

@ -6,7 +6,10 @@ import getUnixTime from 'date-fns/getUnixTime'
import { ProfileTypes, PAGES } from 'config'
import { isLffClient } from 'config/clients'
import type { LiveScore } from 'requests'
import { getCardColor } from 'helpers/getCardColor'
import type { Match } from 'features/Matches'
import { useMatchSwitchesStore } from 'features/MatchSwitches'
import { useName } from 'features/Name'
@ -41,7 +44,6 @@ import {
import { useCardPreview } from './hooks'
import { getPrepareTimeFormat } from '../helpers'
import { getPrepareDateFormat } from '../helpers/getPrepareDateFormat'
import { LiveScore } from '../../../requests/getLiveScores'
type Props = {
isNeedFormatTimeChanged: boolean,

@ -13,14 +13,15 @@ export const useFavouriteTeam = () => {
const [group1, setGroup1] = useState<Array<FavouriteTeams>>([])
const [group2, setGroup2] = useState<Array<FavouriteTeams>>([])
const sortTeam = (teams: Array<any>) => teams.sort((n1:FavouriteTeams, n2: FavouriteTeams) => {
if (n1.name_en > n2.name_en) {
return 1
} if (n1.name_en < n2.name_en) {
return -1
}
return 0
})
const sortTeam = (teams: Array<FavouriteTeams>) => (
teams.sort((n1:FavouriteTeams, n2: FavouriteTeams) => {
if (n1.name_en > n2.name_en) {
return 1
} if (n1.name_en < n2.name_en) {
return -1
}
return 0
}))
const changeActive = (team: FavouriteTeams) => {
setActiveId((prev) => (prev === team.id ? null : team.id))
}

@ -18,13 +18,15 @@ import { useMatchPageStore } from 'features/MatchPage/store'
import { parseDate } from 'helpers/parseDate'
import { ProfileTypes } from 'config'
import { isMobileDevice } from 'config/userAgent'
import { querieKeys } from 'config/queries'
import {
ProfileTypes,
querieKeys,
isMobileDevice,
} from 'config'
import { usePageParams } from 'hooks/usePageParams'
import { getMatchScore } from 'requests/getMatchScore'
import { getMatchScore } from 'requests'
import {
Description,

@ -4,7 +4,8 @@ import { useQuery } from 'react-query'
import { PAGES } from 'config/pages'
import { getLiveScores, LiveScore } from 'requests/getLiveScores'
import type { LiveScore } from 'requests'
import { getLiveScores } from 'requests'
import { MatchCard } from 'features/MatchCard'
import { TournamentList } from 'features/TournamentList'
@ -13,7 +14,7 @@ import { useHeaderFiltersStore } from 'features/HeaderFilters'
import { Wrapper } from './styled'
import { useMatchSwitchesStore } from '../MatchSwitches'
import { querieKeys } from '../../config/queries'
import { querieKeys } from '../../config'
type MatchesGridProps = {
matches: Array<Match>,

@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { useMemo } from 'react'
import { secondsToHms } from 'helpers'

@ -1,3 +1,5 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import styled from 'styled-components/macro'
import { useLexicsStore } from 'features/LexicsStore'

@ -19,7 +19,7 @@ type Props = {
onModalClose: () => void,
onSportClick: (sport: string) => void,
selectedSport: Array<string>,
sportIds: Array<string>,
sportIds: Array<number>,
sports: SportsType,
}
export const SelectSportPopup = ({

@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { useMemo, RefObject } from 'react'
import { secondsToHms } from 'helpers'

@ -1,3 +1,5 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { useRef } from 'react'
import { useEventListener, useToggle } from 'hooks'

@ -1,6 +1,10 @@
import { useEffect, useState } from 'react'
import { getUserSubscribes, Subscribe } from 'requests/getUserSubscribes'
import {
getUserSubscribes,
Subscribe,
Subscribes,
} from 'requests/getUserSubscribes'
import { cancelSubscribe } from 'requests/cancelSubscribe'
import { useLexicsStore } from 'features/LexicsStore'
@ -10,7 +14,7 @@ export const useUserSubscribes = () => {
const { addLexicsConfig } = useLexicsStore()
const [selectedSubscribe, setSelectedSubscribe] = useState<Subscribe>({} as Subscribe)
const [subscribes, setSubscribes] = useState<any>([])
const [subscribes, setSubscribes] = useState<Subscribes>([])
const [isCancelPopupOpen, setIsCancelPopupOpen] = useState(false)
const [changeCardPopupOpen, setChangeCardPopupOpen] = useState(false)
const [isSubCanceled, setSubCanceled] = useState(false)

@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
export type RequestConfig = {
body?: any,
headers?: Headers,

@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import type { RefObject } from 'react'
import { useEffect, useRef } from 'react'

@ -1,29 +0,0 @@
import { useState } from 'react'
export const useLocalStorage = (keyName: string, defaultValue?: any) => {
const [storedValue, setStoredValue] = useState(() => {
try {
const value = localStorage.getItem(keyName)
if (value) {
return JSON.parse(value)
}
localStorage.setItem(keyName, JSON.stringify(defaultValue))
return defaultValue
} catch (err) {
return defaultValue
}
})
const setValue = (newValue: any) => {
try {
localStorage.setItem(keyName, JSON.stringify(newValue))
} catch (err) {
/* eslint-disable-next-line */
console.log(err)
}
setStoredValue(newValue)
}
return [storedValue, setValue]
}

@ -1,3 +1,5 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import type { Dispatch } from 'react'
import { useCallback, useState } from 'react'

@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { useState, useCallback } from 'react'
/**

@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { useState, useEffect } from 'react'
import { queryParamStorage } from 'features/QueryParamsStorage'

@ -123,7 +123,7 @@ export const useHighlightsForm = () => {
const { playerHighlight } = useUserFavoritesStore()
const [sports, setSports] = useState<Array<SportTypeName>>([])
const [sounds, setSounds] = useState<any>([])
const [sounds, setSounds] = useState<Array<Sound>>([])
const [isFetchingTeams, setIsFetchingTeams] = useState(false)
const [teams, setTeams] = useState<Array<TeamType>>([])
const [playersData, setPlayersData] = useState<Array<PlayerType>>([])
@ -301,6 +301,8 @@ export const useHighlightsForm = () => {
useEffect(() => {
if (playerHighlight?.sportType && playerHighlight?.profile) {
// TODO: исправить any
// eslint-disable-next-line
setFormState((state: any) => ({
...state,
selectedPlayer: {

@ -3,6 +3,8 @@ import { API_ROOT } from 'config'
type ResponseSound = {
asset: string,
id: number,
name: string,
}
export const getSound = async (id: number | string): Promise<ResponseSound> => {

@ -3,6 +3,7 @@ import { API_ROOT } from 'config'
type ResponseSound = {
asset: string,
id: number,
name: string,
}

@ -35,7 +35,7 @@ type Team = {
name_ru: string,
}
type Subscribes = Array<Subscribe>
export type Subscribes = Array<Subscribe>
export const getUserSubscribes = (
_p_email: string,

@ -28,3 +28,4 @@ export * from './saveMatchStats'
export * from './getGeoInfo'
export * from './getTokenVirtualUser'
export * from './getMatchScore'
export * from './getLiveScores'

Loading…
Cancel
Save