Skip to content

Commit

Permalink
Merge pull request #10677 from kodadot/chore--fix-some-eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
vikiival authored Jul 24, 2024
2 parents dd881e5 + 0b88694 commit f93f7aa
Show file tree
Hide file tree
Showing 32 changed files with 60 additions and 481 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/reviewdog.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
name: Reviewdog

on:
pull_request:
pull_request: {}
push:
branches: [main]

jobs:
Expand Down
2 changes: 1 addition & 1 deletion components/chart/PriceChart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@
</template>

<script lang="ts" setup>
import { getChartDataByTimeRange } from '@/utils/chart'
import {
NeoButton,
NeoCheckbox,
Expand Down Expand Up @@ -115,6 +114,7 @@ import 'chartjs-adapter-date-fns'
import zoomPlugin from 'chartjs-plugin-zoom'
import { format } from 'date-fns'
import { Line } from 'vue-chartjs'
import { getChartDataByTimeRange } from '@/utils/chart'
ChartJS.register(
zoomPlugin,
Expand Down
16 changes: 8 additions & 8 deletions components/codeChecker/massPreview/Canvas.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,20 @@
>
<CodeCheckerMassPreviewControls
v-model="amount"
:previews="previews"
:previews="canvasPreviews"
@retry="generateMassPreview"
/>

<CodeCheckerMassPreviewGrid
:items="previews.map((p) => p.loading)"
:items="canvasPreviews.map((p) => p.loading)"
class="!mt-4"
>
<template #default="{ index }">
<CodeCheckerSandboxIFrame
:hash="previews[index].hash"
:hash="canvasPreviews[index].hash"
:assets="assets"
:count="1"
:iframe-id="previews[index].hash"
:iframe-id="canvasPreviews[index].hash"
class="border"
/>
</template>
Expand Down Expand Up @@ -56,10 +56,10 @@ const props = withDefaults(
const active = ref(false)
const amount = ref(props.previews)
const previews = ref<CanvasPreviewItem[]>([])
const canvasPreviews = ref<CanvasPreviewItem[]>([])
const generateMassPreview = () => {
previews.value = Array.from({ length: amount.value }).map(() => ({
canvasPreviews.value = Array.from({ length: amount.value }).map(() => ({
hash: generateRandomHash(),
startedAt: performance.now(),
loading: true,
Expand All @@ -70,9 +70,9 @@ useEventListener(window, 'message', async (res) => {
const hash = res.data.payload.hash
if (
res.data?.type === 'kodahash/render/completed'
&& previews.value.map(p => p.hash).includes(hash)
&& canvasPreviews.value.map(p => p.hash).includes(hash)
) {
previews.value = previews.value.map(preview =>
canvasPreviews.value = canvasPreviews.value.map(preview =>
preview.hash === hash
? { ...preview, renderedAt: performance.now(), loading: false }
: preview,
Expand Down
1 change: 1 addition & 0 deletions components/codeChecker/massPreview/Capture.vue
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ const initScreenshot = () => {
}
}
catch (error) {
console.error(error)
}
finally {
preview = { ...preview, loading: false }
Expand Down
1 change: 1 addition & 0 deletions components/collection/activity/Activity.vue
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ const withOffers = computed(() => [...filteredEvents.value, ...offers.value])
// newest events first (bigger timestamp first)
const sortedEventsWithOffersDesc = computed(() =>
// eslint-disable-next-line vue/no-side-effects-in-computed-properties
withOffers.value.sort((a, b) => b.timestamp - a.timestamp),
)
Expand Down
1 change: 1 addition & 0 deletions components/collection/activity/events/Events.vue
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ const eventsAddresses = computed(() => {
const { data: profiles } = useQuery<Profile[] | null>({
queryKey: [
'profiles',
// eslint-disable-next-line vue/no-side-effects-in-computed-properties
computed(() => `${eventsAddresses.value.sort().join(',')}`),
],
queryFn: () =>
Expand Down
2 changes: 2 additions & 0 deletions components/collection/unlockable/ImageSlider.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@
</div>
<template v-if="imageList.length > 1">
<Transition name="fade">
<!-- eslint-disable-next-line vue/require-toggle-inside-transition -->
<div
class="arrow arrow-left arrow-small-size"
@click="slider?.prev()"
/>
</Transition>
<Transition name="fade">
<!-- eslint-disable-next-line vue/require-toggle-inside-transition -->
<div
class="arrow arrow-right arrow-small-size"
@click="slider?.next()"
Expand Down
4 changes: 2 additions & 2 deletions components/common/LoadLazily.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ const props = withDefaults(
},
)
const target = ref<HTMLHtmlElement>()
const targetRef = ref<HTMLHtmlElement>()
const targetIsVisible = useOnceIsVisible(
computed(() => props.target || target.value),
computed(() => props.target || targetRef.value),
)
</script>
6 changes: 3 additions & 3 deletions components/common/autoTeleport/AutoTeleportActionButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ const { $i18n } = useNuxtApp()
const { chainSymbol, name } = useChain()
const { isModalOpen } = useAutoTeleportModal()
const amount = ref()
const amounts = ref()
const {
isAvailable: isAutoTeleportAvailable,
Expand All @@ -167,7 +167,7 @@ const {
clear,
} = useAutoTeleport(
computed<AutoTeleportAction[]>(() => props.actions),
computed(() => amount.value),
computed(() => amounts.value),
props.fees,
)
Expand Down Expand Up @@ -337,7 +337,7 @@ watch(allowAutoTeleport, (allow) => {
watchSyncEffect(() => {
if (!isModalOpen.value) {
amount.value = props.amount
amounts.value = props.amount
}
})
Expand Down
1 change: 1 addition & 0 deletions components/common/shoppingCart/ShoppingCartModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ const clearAllItems = () => {
}
const sortedItems = computed(() =>
// eslint-disable-next-line vue/no-side-effects-in-computed-properties
items.value.sort((a, b) => b.addedAt - a.addedAt),
)
Expand Down
2 changes: 2 additions & 0 deletions components/create/CreateNft.vue
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,8 @@ const imagePreview = computed(() => {
if (form.file) {
return URL?.createObjectURL(form.file)
}
return null
})
// select available blockchain
Expand Down
2 changes: 2 additions & 0 deletions components/gallery/GalleryItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,8 @@ const seoCard = computed(() => {
nftMimeType.value,
)
}
return ''
})
useSeoMeta({
Expand Down
10 changes: 5 additions & 5 deletions components/gallery/GalleryItemDescription.vue
Original file line number Diff line number Diff line change
Expand Up @@ -302,11 +302,7 @@ const descSource = computed(() => {
nftMetadata.value?.description?.replaceAll('\n', ' \n') || '',
)
})
const parent = computed(() => {
if (nft.value?.parent?.id) {
return useGalleryItem(nft.value?.parent?.id)
}
})
const parent = computed(() => nft.value?.parent?.id ? useGalleryItem(nft.value?.parent?.id) : undefined)
const isLewd = computed(() => {
return Boolean(
properties.value?.find((item) => {
Expand All @@ -324,6 +320,8 @@ const recipient = computed(() => {
return nft.value?.recipient
}
}
return undefined
})
defineExpose({ isLewd })
Expand All @@ -334,6 +332,8 @@ const parentNftUrl = computed(() => {
return `/${urlPrefix.value}/${url}/${parent.value?.nft.value?.id}`
}
return ''
})
const properties = computed(() => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<NeoTabs
v-model="activeTab"
v-model="active"
type="toggle"
expanded
data-testid="gallery-item-tabs"
Expand Down Expand Up @@ -48,12 +48,12 @@ const props = withDefaults(
const nft = computed(() => props.galleryItem.nft.value)
const activeTab = ref('1')
const active = ref('1')
const collectionId = ref('')
watchEffect(() => {
if (props.activeTab) {
activeTab.value = props.activeTab
active.value = props.activeTab
}
collectionId.value = nft.value?.collection.id || ''
Expand Down
2 changes: 2 additions & 0 deletions components/profile/create/stages/Form.vue
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,8 @@ const deleteConfirmSafetyDelayText = computed(() => {
),
])
}
return ''
})
const deleteConfirmText = computed(() =>
Expand Down
50 changes: 0 additions & 50 deletions components/rmrk/service/Consolidator.ts
Original file line number Diff line number Diff line change
@@ -1,48 +1,5 @@
import { u8aToHex } from '@polkadot/util'
import { decodeAddress } from '@polkadot/keyring'
import type { NFT } from './scheme'

export default class Consolidator {
public static isPermitedInteraction(): boolean {
return true
}

public static canTransfer(nft: NFT): void {
if (!nft.transferable) {
throw new ValidationError(`NFT ${nft._id} is not transferable`)
}
}

public static isAvailableForSale(nft: NFT, previousOwner: string): boolean {
return Consolidator.callerEquals(nft.currentOwner, previousOwner)
}

// private static canMintNft() {

// }

// private static canSend() {

// }

// private static canList() {

// }

// private static canChangeIssuer() {

// }

// public static isValidCollection() {

// }

// public static validate() {}

private static callerEquals(ownerId: string, caller: string): boolean {
return ownerId === caller
}
}

function accountIdToPubKey(accountId: string) {
return (accountId && u8aToHex(decodeAddress(accountId))) || ''
Expand All @@ -61,10 +18,3 @@ export function generateId(caller: string, symbol: string): string {
+ (symbol || '')
).toUpperCase()
}

class ValidationError extends Error {
constructor(message: string) {
super(message)
this.name = 'ValidationError'
}
}
Loading

0 comments on commit f93f7aa

Please sign in to comment.