Skip to content

Commit

Permalink
🔧 eslint rules
Browse files Browse the repository at this point in the history
  • Loading branch information
roiLeo committed Oct 15, 2024
1 parent ca880f8 commit b458a8c
Show file tree
Hide file tree
Showing 25 changed files with 46 additions and 117 deletions.
3 changes: 2 additions & 1 deletion components/carousel/module/CarouselAgnostic.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ import 'keen-slider/keen-slider.min.css'
import { useKeenSlider } from 'keen-slider/vue'
import { NeoIcon } from '@kodadot1/brick'
import { CarouselWheelsPlugin } from '../utils/useCarousel'
import type { CarouselNFT } from '@/components/base/types'
type CarouseBreakpoints = '640px' | '768px' | '1024px' | '1280px' | '1540px'
Expand All @@ -64,7 +65,7 @@ const SYNC_CONFIG_DEBOUNCE_AMOUNT = 1 // anything bellow this makes the carousel
const DEFAULT_SLIDES_CONFIG = { perView: 3, spacing: 16 }
const props = defineProps<{
items: any[]
items: CarouselNFT[]
step?: number
breakpoints?: CarouseBreakpointsConfig
config?: CarouselConfig
Expand Down
4 changes: 2 additions & 2 deletions components/collection/CollectionGrid.vue
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ const resetPage = useDebounceFn(() => {
}, 1000)
const buildSearchParam = (): Record<string, unknown>[] => {
const params: any[] = []
const params: Record<string, unknown>[] = []
if (searchQuery.search) {
params.push({
name_containsInsensitive: searchQuery.search,
Expand Down Expand Up @@ -206,7 +206,7 @@ const handleResult = (
return
}
const newCollections = data.collectionEntities.map((e: any) => ({
const newCollections = data.collectionEntities.map((e: Collection) => ({
...e,
}))
Expand Down
2 changes: 1 addition & 1 deletion components/create/CreateCollection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@
</form>
<CreateModalsCollectionSuccessModal
v-model="displaySuccessModal"
:tx-hash="txHash as string"
:tx-hash="String(txHash)"
:status="status"
:collection="mintedCollectionInfo"
/>
Expand Down
2 changes: 1 addition & 1 deletion components/profile/activityTab/History.vue
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ export interface Event {
Date: string
Time: string
Block: string
Item?: any
Item?: Record<string, unknown>
Percentage?: number
}
Expand Down
2 changes: 1 addition & 1 deletion components/series/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export type BuyHistory = {
export type RowSeries = {
id: string
unique: number
image: any
image: string
metadata: string
sold: number
total: number
Expand Down
2 changes: 1 addition & 1 deletion components/shared/ResponsiveTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const { variant, desktop } = useResponsive(container)
withDefaults(
defineProps<{
items: any[]
items: []
noResultsMain: string
noResultsSub: string
showNoResults: boolean
Expand Down
2 changes: 1 addition & 1 deletion components/shared/audioPlayer/Waveform.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const colors = {
},
}
const initWaveform = (media: any) => {
const initWaveform = (media: HTMLMediaElement) => {
wavesurfer.value = WaveSurfer.create({
container: wavesurferWrapper.value,
height: 33,
Expand Down
2 changes: 1 addition & 1 deletion components/shared/filters/modules/StatusFilter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ const owned
set: value => exploreFiltersStore.setOwned(value),
})
const applyToUrl = (queryCondition: { [key: string]: any }) => {
const applyToUrl = (queryCondition: { [key: string]: string }) => {
replaceURL(queryCondition)
emit('resetPage')
}
Expand Down
5 changes: 2 additions & 3 deletions components/shared/nftCard/NftCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
<script lang="ts" setup>
import { computed } from 'vue'
import { NeoSkeleton } from '@kodadot1/brick'
import type { ComputedOptions, ConcreteComponent, MethodOptions } from 'vue'
import type { ConcreteComponent } from 'vue'
import NftMediaInfoStacked from './NftMediaInfoStacked.vue'
import NftMediaInfo from './NftMediaInfo.vue'
Expand All @@ -132,8 +132,7 @@ const props = withDefaults(
cardIconSrc?: string
link?:
| string
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types
| ConcreteComponent<{}, any, any, ComputedOptions, MethodOptions>
| ConcreteComponent
bindKey?: string
showActionOnHover?: boolean
mediaPlayerCover?: string
Expand Down
8 changes: 4 additions & 4 deletions components/transfer/Transfer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,7 @@ const generateTokenTabs = (
const getQueryMultipleKeys = (
queryKey: string,
filter: (value: [string, any]) => boolean,
filter: (value: [string, unknown]) => boolean,
) =>
Object.entries(route.query)
.filter(([key]) => key.startsWith(queryKey))
Expand Down Expand Up @@ -839,7 +839,7 @@ const getTransactionFee = async () => {
decimals.value as number,
)
return estimate(accountId.value, cb as any, arg as any)
return estimate(accountId.value, cb, arg as [])
}
const calculateTransactionFee = async () => {
Expand Down Expand Up @@ -890,7 +890,7 @@ const getTransferParams = async (
}
const submit = async (
event: any,
event: unknown,
usedNodeUrls: string[] = [],
): Promise<void> => {
isTransferModalVisible.value = false
Expand Down Expand Up @@ -923,7 +923,7 @@ const submit = async (
),
)
}
catch (e: any) {
catch (e: unknown) {
if (e.message === 'Cancelled') {
warningMessage($i18n.t('general.tx.cancelled'), { reportable: false })
isLoading.value = false
Expand Down
2 changes: 1 addition & 1 deletion composables/party/useParty.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export default <T>({ room, onMessage, disabled }: UsePartyParams<T>) => {
})
}

const sendMessage = (value: any) => {
const sendMessage = (value: T) => {
wss.value.get(room.value)?.send(JSON.stringify(value))
}

Expand Down
4 changes: 2 additions & 2 deletions composables/transaction/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ export type ExecuteTransactionSuccessMessage =
| ObjectMessage

type BaseExecuteTransactionParams = {
arg: any[]
arg: []
successMessage?: ExecuteTransactionSuccessMessage
errorMessage?: string | (() => string)
}

export type ExecuteSubstrateTransactionParams = {
cb: (...params: any[]) => Extrinsic
cb: (...params: []) => Extrinsic
} & BaseExecuteTransactionParams

export type Abi = ViemAbi
Expand Down
4 changes: 2 additions & 2 deletions composables/useAsyncRetry.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
type Item = {
id: string
promise: () => Promise<any>
promise: () => Promise<unknown>
}

export default (retryCount: number = 3) => {
const states = ref(
new Map<string, { tries: number, fulfilled: boolean, response?: any }>(),
new Map<string, { tries: number, fulfilled: boolean, response?: unknown }>(),
)

const stateValues = computed(() =>
Expand Down
4 changes: 2 additions & 2 deletions composables/useMetaTransaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ type HowAboutToExecuteOptions = {

export type HowAboutToExecute = (
account: string,
cb: (...params: any[]) => Extrinsic,
args: any[],
cb: (...params: []) => Extrinsic,
args: [],
options?: HowAboutToExecuteOptions
) => Promise<void>

Expand Down
5 changes: 2 additions & 3 deletions libs/ui/src/components/NeoButton/NeoButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
</template>

<script lang="ts" setup>
import type { ComputedOptions, ConcreteComponent, MethodOptions } from 'vue'
import type { ConcreteComponent } from 'vue'
import { OButton } from '@oruga-ui/oruga-next'
import { useMousePressed } from '@vueuse/core'
import type { NeoButtonVariant } from '../../types'
Expand All @@ -54,8 +54,7 @@ const props = withDefaults(
shiny?: boolean
tag?:
| string
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types
| ConcreteComponent<{}, any, any, ComputedOptions, MethodOptions>
| ConcreteComponent
loadingWithLabel?: boolean
}>(),
{
Expand Down
5 changes: 1 addition & 4 deletions libs/ui/src/components/TheImage/TheImage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,15 @@

<script lang="ts" setup>
import type {
ComputedOptions,
ConcreteComponent,
ImgHTMLAttributes,
MethodOptions,
ReservedProps,
} from 'vue'
import { computed, withDefaults } from 'vue'
export type ImageComponent =
| 'img'
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types
| ConcreteComponent<{}, any, any, ComputedOptions, MethodOptions>
| ConcreteComponent
| string
export type ImageComponentProps = Record<string, unknown>
Expand Down
3 changes: 1 addition & 2 deletions utils/api/bsx/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,5 @@ export type AssetRegistryMetadata = {

export type ExtrinsicCall = {
call: SubmittableExtrinsicFunction<'promise', AnyTuple>
// eslint-disable-next-line @typescript-eslint/no-explicit-any
args: any[]
args: []
}
64 changes: 0 additions & 64 deletions utils/directives/DeviceOrientation.ts

This file was deleted.

2 changes: 1 addition & 1 deletion utils/fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const fetchMimeType = async (
try {
return await getMimeType(assetUrl)
}
catch (e: any) {
catch (e: unknown) {
logError(e, (msg) => {
console.warn(
`[MIME TYPE] Unable to access type of ${assetUrl}\n\nReason ${msg}`,
Expand Down
2 changes: 1 addition & 1 deletion utils/filters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const EMPTY = '0.00 %'
export const toNumber = (value: BN | number): number =>
BN.isBN(value) ? Number(value.toString()) : value || 0

export const toString = (value: any) => (value && value.toString()) || ''
export const toString = (value: unknown) => (value && value.toString()) || ''

export const toPercent = (
value: number | undefined | BN,
Expand Down
2 changes: 1 addition & 1 deletion utils/format/balance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function format(
withSi,
})
}
catch (e: any) {
catch (e: unknown) {
return ''
}
}
Expand Down
4 changes: 2 additions & 2 deletions utils/gallery/abstractCalls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const uniqueParamResolver = (
id: string,
selectedAction: string,
meta: string | number,
): any[] => {
): [] => {
const sanitized = correctId(id)
const [collectionId, tokenId] = sanitized.split('-')
const actions = {
Expand All @@ -46,7 +46,7 @@ export const nftParamResolver = (
id: string,
selectedAction: string,
meta: string | number,
): any[] => {
): [] => {
const sanitized = correctId(id)
const [collectionId, tokenId] = sanitized.split('-')
const actions = {
Expand Down
12 changes: 6 additions & 6 deletions utils/objects.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
type Item = { [key: string]: any }
type Item = { [key: string]: unknown }

export const getMovedItemToFront = (
arr: Item[] | any[],
keyOrValue: string | any,
value?: any,
): (Item | any)[] => {
arr: Item[] | [],
keyOrValue: string,
value?: string,
): (Item)[] => {
let index: number

if (typeof keyOrValue === 'string' && value !== undefined) {
index = (arr as Item[]).findIndex(obj => obj[keyOrValue] === value)
}
else {
index = (arr as any[]).findIndex(item => item === keyOrValue)
index = (arr as []).findIndex(item => item === keyOrValue)
}

if (index === -1) {
Expand Down
Loading

0 comments on commit b458a8c

Please sign in to comment.