From 5b4c0ffdf32fa7c56dacb40f6a640f118c2a8806 Mon Sep 17 00:00:00 2001 From: Johann150 Date: Fri, 12 Aug 2022 08:35:22 +0200 Subject: [PATCH] client: fix some lints Mostly focused on "@typescript-eslint/no-unused-vars" but also fixed some other lints along the way. --- packages/client/src/components/MkNoteSub.vue | 4 +- .../src/components/abuse-report-window.vue | 4 +- .../client/src/components/abuse-report.vue | 7 ++-- .../client/src/components/analog-clock.vue | 2 +- .../client/src/components/chart-tooltip.vue | 2 +- packages/client/src/components/chart.vue | 10 ++--- .../client/src/components/cropper-dialog.vue | 2 +- .../src/components/date-separated-list.vue | 2 +- .../client/src/components/drive.folder.vue | 8 ---- .../src/components/drive.nav-folder.vue | 8 ---- packages/client/src/components/drive.vue | 2 +- .../src/components/file-list-for-admin.vue | 7 +--- packages/client/src/components/form/input.vue | 5 +-- packages/client/src/components/form/range.vue | 2 +- .../client/src/components/form/select.vue | 7 ++-- .../client/src/components/form/suspense.vue | 1 - .../client/src/components/form/switch.vue | 1 - .../client/src/components/form/textarea.vue | 12 ++---- packages/client/src/components/formula.vue | 1 - .../src/components/gallery-post-preview.vue | 1 - packages/client/src/components/global/a.vue | 31 +++----------- .../client/src/components/global/avatar.vue | 2 +- .../client/src/components/global/emoji.vue | 2 +- .../client/src/components/global/loading.vue | 2 +- .../global/misskey-flavored-markdown.vue | 2 +- .../src/components/global/page-header.vue | 9 ++--- .../src/components/global/router-view.vue | 4 +- .../client/src/components/global/spacer.vue | 4 +- .../src/components/global/user-name.vue | 2 +- .../client/src/components/instance-stats.vue | 9 ++--- packages/client/src/components/marquee.vue | 2 +- .../client/src/components/media-banner.vue | 7 ++-- packages/client/src/components/media-list.vue | 3 -- packages/client/src/components/mini-chart.vue | 3 +- .../src/components/modal-page-window.vue | 6 +-- .../client/src/components/note-detailed.vue | 6 +-- .../client/src/components/note-preview.vue | 2 +- .../client/src/components/note-simple.vue | 2 +- packages/client/src/components/note.vue | 15 ++++--- packages/client/src/components/notes.vue | 2 +- .../src/components/notification-toast.vue | 2 +- .../client/src/components/notifications.vue | 5 +-- .../client/src/components/object-view.vue | 2 +- .../client/src/components/page-preview.vue | 1 - .../client/src/components/page-window.vue | 8 +--- packages/client/src/components/poll.vue | 2 +- packages/client/src/components/post-form.vue | 21 +--------- .../client/src/components/queue-chart.vue | 2 - .../client/src/components/reaction-icon.vue | 10 +++-- .../src/components/reaction-tooltip.vue | 4 +- .../components/reactions-viewer.details.vue | 6 +-- .../client/src/components/signin-dialog.vue | 6 +-- packages/client/src/components/signin.vue | 1 - .../client/src/components/signup-dialog.vue | 8 ++-- packages/client/src/components/sparkle.vue | 3 +- packages/client/src/components/timeline.vue | 3 +- .../client/src/components/ui/container.vue | 2 +- packages/client/src/components/ui/info.vue | 1 - .../client/src/components/ui/modal-window.vue | 4 +- packages/client/src/components/ui/modal.vue | 6 +-- .../client/src/components/ui/pagination.vue | 8 ++-- .../client/src/components/ui/super-menu.vue | 2 +- .../client/src/components/url-preview.vue | 2 +- packages/client/src/components/user-list.vue | 3 +- .../src/components/user-select-dialog.vue | 2 +- .../client/src/components/users-tooltip.vue | 4 +- packages/client/src/components/visibility.vue | 1 - .../client/src/directives/adaptive-border.ts | 2 +- packages/client/src/directives/anim.ts | 4 +- packages/client/src/directives/appear.ts | 4 +- packages/client/src/directives/get-size.ts | 6 +-- packages/client/src/directives/panel.ts | 2 +- packages/client/src/directives/ripple.ts | 2 +- packages/client/src/directives/size.ts | 8 ++-- .../client/src/directives/sticky-container.ts | 4 +- packages/client/src/directives/tooltip.ts | 4 +- .../client/src/directives/user-preview.ts | 4 +- packages/client/src/init.ts | 2 +- packages/client/src/menu.ts | 2 +- packages/client/src/nirax.ts | 3 +- packages/client/src/os.ts | 40 +++++++++---------- packages/client/src/pages/_error_.vue | 9 ++--- packages/client/src/pages/about.vue | 4 +- packages/client/src/pages/admin-file.vue | 2 - packages/client/src/pages/admin/_header_.vue | 9 ++--- packages/client/src/pages/admin/abuses.vue | 13 ------ .../src/pages/admin/emoji-edit-dialog.vue | 1 - packages/client/src/pages/admin/emojis.vue | 3 +- packages/client/src/pages/admin/files.vue | 7 +--- packages/client/src/pages/admin/index.vue | 6 +-- packages/client/src/plugin.ts | 5 +-- packages/client/src/router.ts | 1 - packages/client/src/scripts/get-note-menu.ts | 3 +- packages/client/src/ui/classic.vue | 2 +- packages/client/src/ui/deck/main-column.vue | 2 +- packages/client/src/ui/universal.vue | 2 +- packages/client/src/ui/visitor/b.vue | 2 +- packages/client/src/ui/zen.vue | 2 +- packages/shared/.eslintrc.js | 2 +- 99 files changed, 174 insertions(+), 310 deletions(-) diff --git a/packages/client/src/components/MkNoteSub.vue b/packages/client/src/components/MkNoteSub.vue index aac3f233b..57206f1d8 100644 --- a/packages/client/src/components/MkNoteSub.vue +++ b/packages/client/src/components/MkNoteSub.vue @@ -33,16 +33,16 @@ import XNoteHeader from './note-header.vue'; import MkNoteSubNoteContent from './sub-note-content.vue'; import XCwButton from './cw-button.vue'; import { notePage } from '@/filters/note'; -import * as os from '@/os'; import { i18n } from '@/i18n'; const props = withDefaults(defineProps<{ note: misskey.entities.Note; - conversation?: misskey.entities.Note[]; + conversation?: misskey.entities.Note[] | null; // how many notes are in between this one and the note being viewed in detail depth?: number; }>(), { + conversation: null, depth: 1, }); diff --git a/packages/client/src/components/abuse-report-window.vue b/packages/client/src/components/abuse-report-window.vue index 1f849c47a..6a94665b5 100644 --- a/packages/client/src/components/abuse-report-window.vue +++ b/packages/client/src/components/abuse-report-window.vue @@ -43,12 +43,12 @@ const emit = defineEmits<{ const uiWindow = ref>(); const comment = ref(''); -function send() { +function send(): void { os.apiWithDialog('users/report-abuse', { userId: props.user.id, urls: props.urls || [], comment: comment.value, - }).then(res => { + }).then(() => { os.alert({ type: 'success', text: i18n.ts.abuseReported, diff --git a/packages/client/src/components/abuse-report.vue b/packages/client/src/components/abuse-report.vue index db087841a..ac285a544 100644 --- a/packages/client/src/components/abuse-report.vue +++ b/packages/client/src/components/abuse-report.vue @@ -21,7 +21,7 @@
{{ i18n.ts.notes }}:
    -
  • +

@@ -47,12 +47,11 @@ import MkButton from '@/components/ui/button.vue'; import MkSwitch from '@/components/form/switch.vue'; import MkKeyValue from '@/components/key-value.vue'; import MkUrl from '@/components/global/url.vue'; -import { acct, userPage } from '@/filters/user'; import * as os from '@/os'; import { i18n } from '@/i18n'; const props = defineProps<{ - report: any; + report: Record; }>(); const emit = defineEmits<{ @@ -61,7 +60,7 @@ const emit = defineEmits<{ let forward = $ref(props.report.forwarded); -function resolve() { +function resolve(): void { os.apiWithDialog('admin/resolve-abuse-user-report', { forward, reportId: props.report.id, diff --git a/packages/client/src/components/analog-clock.vue b/packages/client/src/components/analog-clock.vue index 3aa8a0f12..8dac0dc2e 100644 --- a/packages/client/src/components/analog-clock.vue +++ b/packages/client/src/components/analog-clock.vue @@ -83,7 +83,7 @@ const graduations = computed(() => { return angles; }); -function tick() { +function tick(): void { now.value = new Date(); } diff --git a/packages/client/src/components/chart-tooltip.vue b/packages/client/src/components/chart-tooltip.vue index 9b57a1b3d..0f8adbf9a 100644 --- a/packages/client/src/components/chart-tooltip.vue +++ b/packages/client/src/components/chart-tooltip.vue @@ -16,7 +16,7 @@ import { } from 'vue'; import MkTooltip from './ui/tooltip.vue'; -const props = defineProps<{ +defineProps<{ showing: boolean; x: number; y: number; diff --git a/packages/client/src/components/chart.vue b/packages/client/src/components/chart.vue index fc7c4ff95..2b55badee 100644 --- a/packages/client/src/components/chart.vue +++ b/packages/client/src/components/chart.vue @@ -13,7 +13,7 @@ id-denylist violation when setting it. This is causing about 60+ lint issues. As this is part of Chart.js's API it makes sense to disable the check here. */ -import { onMounted, ref, watch, PropType, onUnmounted } from 'vue'; +import { onMounted, ref, watch, PropType } from 'vue'; import { Chart, ArcElement, @@ -173,7 +173,7 @@ const render = () => { // フォントカラー Chart.defaults.color = getComputedStyle(document.documentElement).getPropertyValue('--fg'); - const maxes = chartData.series.map((x, i) => Math.max(...x.data.map(d => d.y))); + const maxes = chartData.series.map((x) => Math.max(...x.data.map(d => d.y))); chartInstance = new Chart(chartEl.value, { type: props.bar ? 'bar' : 'line', @@ -315,7 +315,7 @@ const render = () => { }, plugins: [{ id: 'vLine', - beforeDraw(chart, args, options) { + beforeDraw(chart) { if (chart.tooltip._active && chart.tooltip._active.length) { const activePoint = chart.tooltip._active[0]; const ctx = chart.ctx; @@ -337,10 +337,6 @@ const render = () => { }); }; -const exportData = () => { - // TODO -}; - const fetchFederationChart = async (): Promise => { const raw = await os.apiGet('charts/federation', { limit: props.limit, span: props.span }); return { diff --git a/packages/client/src/components/cropper-dialog.vue b/packages/client/src/components/cropper-dialog.vue index 28676ebff..4b241436d 100644 --- a/packages/client/src/components/cropper-dialog.vue +++ b/packages/client/src/components/cropper-dialog.vue @@ -26,7 +26,7 @@ diff --git a/packages/client/src/components/form/input.vue b/packages/client/src/components/form/input.vue index 5abd57d29..ea479c920 100644 --- a/packages/client/src/components/form/input.vue +++ b/packages/client/src/components/form/input.vue @@ -34,7 +34,7 @@ diff --git a/packages/client/src/components/global/avatar.vue b/packages/client/src/components/global/avatar.vue index 1d0862761..2e6155659 100644 --- a/packages/client/src/components/global/avatar.vue +++ b/packages/client/src/components/global/avatar.vue @@ -10,7 +10,7 @@ diff --git a/packages/client/src/components/marquee.vue b/packages/client/src/components/marquee.vue index 5ca04b0b4..276c78d05 100644 --- a/packages/client/src/components/marquee.vue +++ b/packages/client/src/components/marquee.vue @@ -47,7 +47,7 @@ export default { }, render({ $slots, $style, $props: { - duration, repeat, paused, reverse, + repeat, paused, reverse, }, }) { return h('div', { class: [$style.wrap] }, [ diff --git a/packages/client/src/components/media-banner.vue b/packages/client/src/components/media-banner.vue index e1bd0a187..872b7888d 100644 --- a/packages/client/src/components/media-banner.vue +++ b/packages/client/src/components/media-banner.vue @@ -34,15 +34,14 @@ import * as misskey from 'misskey-js'; import { ColdDeviceStorage } from '@/store'; import { i18n } from '@/i18n'; -const props = withDefaults(defineProps<{ +defineProps<{ media: misskey.entities.DriveFile; -}>(), { -}); +}>(); const audioEl = $ref(); let hide = $ref(true); -function volumechange() { +function volumechange(): void { if (audioEl) ColdDeviceStorage.set('mediaVolume', audioEl.volume); } diff --git a/packages/client/src/components/media-list.vue b/packages/client/src/components/media-list.vue index 7e330575e..8e14bc374 100644 --- a/packages/client/src/components/media-list.vue +++ b/packages/client/src/components/media-list.vue @@ -23,7 +23,6 @@ import XImage from './media-image.vue'; import XVideo from './media-video.vue'; import * as os from '@/os'; import { FILE_TYPE_BROWSERSAFE } from '@/const'; -import { defaultStore } from '@/store'; const props = defineProps<{ mediaList: misskey.entities.DriveFile[]; @@ -31,7 +30,6 @@ const props = defineProps<{ }>(); const gallery = ref(null); -const pswpZIndex = os.claimZIndex('middle'); onMounted(() => { const lightbox = new PhotoSwipeLightbox({ @@ -183,7 +181,6 @@ const previewable = (file: misskey.entities.DriveFile): boolean => { diff --git a/packages/client/src/components/mini-chart.vue b/packages/client/src/components/mini-chart.vue index c64ce163f..0547fca5b 100644 --- a/packages/client/src/components/mini-chart.vue +++ b/packages/client/src/components/mini-chart.vue @@ -26,7 +26,7 @@ diff --git a/packages/client/src/components/note-simple.vue b/packages/client/src/components/note-simple.vue index b813b9a2b..f22484a75 100644 --- a/packages/client/src/components/note-simple.vue +++ b/packages/client/src/components/note-simple.vue @@ -23,7 +23,7 @@ import XNoteHeader from './note-header.vue'; import MkNoteSubNoteContent from './sub-note-content.vue'; import XCwButton from './cw-button.vue'; -const props = defineProps<{ +defineProps<{ note: misskey.entities.Note; pinned?: boolean; }>(); diff --git a/packages/client/src/components/note.vue b/packages/client/src/components/note.vue index 64607136f..6268ac937 100644 --- a/packages/client/src/components/note.vue +++ b/packages/client/src/components/note.vue @@ -80,7 +80,7 @@ -