From 5e29528ad4d75174b4a8ebd462f0ff830c5b1c43 Mon Sep 17 00:00:00 2001 From: Johann150 Date: Fri, 10 Jun 2022 07:36:55 +0200 Subject: [PATCH] chore: fix some lints automatically (#8788) * chore: fix some lints automatically Fixed lints that were automatically fixable with `eslint --fix`. * fix type * workaround for empty interface lint --- packages/client/.eslintrc.js | 6 ++++++ packages/client/src/components/captcha.vue | 3 +-- packages/client/src/components/drive.folder.vue | 4 ++-- packages/client/src/components/drive.vue | 8 ++++---- packages/client/src/components/form/folder.vue | 2 +- packages/client/src/components/form/radios.vue | 2 +- packages/client/src/components/page/page.post.vue | 2 +- packages/client/src/components/post-form-attaches.vue | 10 +++++----- packages/client/src/components/post-form.vue | 2 +- packages/client/src/components/queue-chart.vue | 2 +- packages/client/src/components/sample.vue | 2 +- packages/client/src/components/signin.vue | 4 ++-- packages/client/src/components/signup.vue | 2 +- packages/client/src/components/ui/button.vue | 10 +++++----- packages/client/src/components/ui/modal.vue | 2 +- packages/client/src/components/ui/tooltip.vue | 10 +++++----- packages/client/src/components/url-preview.vue | 2 +- packages/client/src/directives/adaptive-border.ts | 2 +- packages/client/src/directives/get-size.ts | 6 +++--- packages/client/src/directives/panel.ts | 2 +- packages/client/src/directives/size.ts | 4 ++-- packages/client/src/os.ts | 2 +- packages/client/src/pages/admin/emojis.vue | 2 +- packages/client/src/pages/admin/metrics.vue | 2 +- packages/client/src/pages/admin/queue.vue | 4 ++-- packages/client/src/pages/auth.form.vue | 2 +- packages/client/src/pages/emojis.category.vue | 2 +- packages/client/src/pages/federation.vue | 2 +- packages/client/src/pages/gallery/edit.vue | 2 +- packages/client/src/pages/messaging/index.vue | 4 ++-- .../client/src/pages/messaging/messaging-room.form.vue | 2 +- packages/client/src/pages/mfm-cheat-sheet.vue | 2 +- packages/client/src/pages/my-antennas/index.vue | 2 +- packages/client/src/pages/page-editor/page-editor.vue | 2 +- packages/client/src/pages/scratchpad.vue | 2 +- packages/client/src/pages/settings/2fa.vue | 2 +- packages/client/src/pages/settings/accounts.vue | 2 +- packages/client/src/pages/settings/apps.vue | 2 +- packages/client/src/pages/settings/theme.vue | 4 ++-- packages/client/src/pages/settings/word-mute.vue | 2 +- packages/client/src/pages/share.vue | 2 +- packages/client/src/pages/theme-editor.vue | 2 +- packages/client/src/pages/timeline.vue | 2 +- packages/client/src/pages/welcome.setup.vue | 2 +- packages/client/src/pages/welcome.timeline.vue | 2 +- packages/client/src/scripts/format-time-string.ts | 6 +++--- packages/client/src/scripts/get-note-menu.ts | 2 +- packages/client/src/scripts/get-user-menu.ts | 2 +- packages/client/src/scripts/hpml/evaluator.ts | 2 +- packages/client/src/scripts/physics.ts | 6 +++--- packages/client/src/scripts/theme-editor.ts | 2 +- packages/client/src/scripts/theme.ts | 2 +- packages/client/src/store.ts | 2 +- packages/client/src/ui/_common_/sidebar-for-mobile.vue | 2 +- packages/client/src/ui/classic.sidebar.vue | 2 +- packages/client/src/ui/deck/column.vue | 1 - packages/client/src/widgets/timeline.vue | 8 ++++---- packages/client/src/widgets/widget.ts | 2 +- 58 files changed, 92 insertions(+), 88 deletions(-) diff --git a/packages/client/.eslintrc.js b/packages/client/.eslintrc.js index 1c2ab0a42..10f0e5a9c 100644 --- a/packages/client/.eslintrc.js +++ b/packages/client/.eslintrc.js @@ -15,6 +15,12 @@ module.exports = { 'plugin:vue/vue3-recommended', ], rules: { + '@typescript-eslint/no-empty-interface': [ + 'error', + { + 'allowSingleExtends': true, + }, + ], // window の禁止理由: グローバルスコープと衝突し、予期せぬ結果を招くため // data の禁止理由: 抽象的すぎるため // e の禁止理由: error や event など、複数のキーワードの頭文字であり分かりにくいため diff --git a/packages/client/src/components/captcha.vue b/packages/client/src/components/captcha.vue index ccd8880df..183658471 100644 --- a/packages/client/src/components/captcha.vue +++ b/packages/client/src/components/captcha.vue @@ -27,8 +27,7 @@ type CaptchaContainer = { }; declare global { - interface Window extends CaptchaContainer { - } + interface Window extends CaptchaContainer { } } const props = defineProps<{ diff --git a/packages/client/src/components/drive.folder.vue b/packages/client/src/components/drive.folder.vue index d530f8bef..3ccb5d621 100644 --- a/packages/client/src/components/drive.folder.vue +++ b/packages/client/src/components/drive.folder.vue @@ -71,7 +71,7 @@ function onMouseover() { } function onMouseout() { - hover.value = false + hover.value = false; } function onDragover(ev: DragEvent) { @@ -204,7 +204,7 @@ function deleteFolder() { defaultStore.set('uploadFolder', null); } }).catch(err => { - switch(err.id) { + switch (err.id) { case 'b0fc8a17-963c-405d-bfbc-859a487295e1': os.alert({ type: 'error', diff --git a/packages/client/src/components/drive.vue b/packages/client/src/components/drive.vue index 42ec3a599..6c2c8acad 100644 --- a/packages/client/src/components/drive.vue +++ b/packages/client/src/components/drive.vue @@ -143,7 +143,7 @@ const fetching = ref(true); const ilFilesObserver = new IntersectionObserver( (entries) => entries.some((entry) => entry.isIntersecting) && !fetching.value && moreFiles.value && fetchMoreFiles() -) +); watch(folder, () => emit('cd', folder.value)); @@ -332,7 +332,7 @@ function deleteFolder(folderToDelete: Misskey.entities.DriveFolder) { // 削除時に親フォルダに移動 move(folderToDelete.parentId); }).catch(err => { - switch(err.id) { + switch (err.id) { case 'b0fc8a17-963c-405d-bfbc-859a487295e1': os.alert({ type: 'error', @@ -607,7 +607,7 @@ function onContextmenu(ev: MouseEvent) { onMounted(() => { if (defaultStore.state.enableInfiniteScroll && loadMoreFiles.value) { nextTick(() => { - ilFilesObserver.observe(loadMoreFiles.value?.$el) + ilFilesObserver.observe(loadMoreFiles.value?.$el); }); } @@ -628,7 +628,7 @@ onMounted(() => { onActivated(() => { if (defaultStore.state.enableInfiniteScroll) { nextTick(() => { - ilFilesObserver.observe(loadMoreFiles.value?.$el) + ilFilesObserver.observe(loadMoreFiles.value?.$el); }); } }); diff --git a/packages/client/src/components/form/folder.vue b/packages/client/src/components/form/folder.vue index 571afe50c..1b960657d 100644 --- a/packages/client/src/components/form/folder.vue +++ b/packages/client/src/components/form/folder.vue @@ -24,7 +24,7 @@ const props = withDefaults(defineProps<{ defaultOpen: boolean; }>(), { defaultOpen: false, -}) +}); let opened = $ref(props.defaultOpen); let openedAtLeastOnce = $ref(props.defaultOpen); diff --git a/packages/client/src/components/form/radios.vue b/packages/client/src/components/form/radios.vue index ff5d51f9c..a52acae9e 100644 --- a/packages/client/src/components/form/radios.vue +++ b/packages/client/src/components/form/radios.vue @@ -14,7 +14,7 @@ export default defineComponent({ data() { return { value: this.modelValue, - } + }; }, watch: { value() { diff --git a/packages/client/src/components/page/page.post.vue b/packages/client/src/components/page/page.post.vue index 8ac8c4669..3401f945b 100644 --- a/packages/client/src/components/page/page.post.vue +++ b/packages/client/src/components/page/page.post.vue @@ -66,7 +66,7 @@ export default defineComponent({ .then(response => response.json()) .then(f => { ok(f); - }) + }); }); }); os.promiseDialog(promise); diff --git a/packages/client/src/components/post-form-attaches.vue b/packages/client/src/components/post-form-attaches.vue index 380776911..6b9827407 100644 --- a/packages/client/src/components/post-form-attaches.vue +++ b/packages/client/src/components/post-form-attaches.vue @@ -16,7 +16,7 @@ diff --git a/packages/client/src/components/sample.vue b/packages/client/src/components/sample.vue index 65249ff7e..f80b9c96b 100644 --- a/packages/client/src/components/sample.vue +++ b/packages/client/src/components/sample.vue @@ -52,7 +52,7 @@ export default defineComponent({ flag: true, radio: 'misskey', mfm: `Hello world! This is an @example mention. BTW you are @${this.$i ? this.$i.username : 'guest'}.\nAlso, here is ${config.url} and [example link](${config.url}). for more details, see https://example.com.\nAs you know #misskey is open-source software.` - } + }; }, methods: { diff --git a/packages/client/src/components/signin.vue b/packages/client/src/components/signin.vue index be8727402..b772d1479 100644 --- a/packages/client/src/components/signin.vue +++ b/packages/client/src/components/signin.vue @@ -159,7 +159,7 @@ function queryKey() { function onSubmit() { signing = true; - console.log('submit') + console.log('submit'); if (!totpLogin && user && user.twoFactorEnabled) { if (window.PublicKeyCredential && user.securityKeys) { os.api('signin', { @@ -222,7 +222,7 @@ function loginFailed(err) { break; } default: { - console.log(err) + console.log(err); os.alert({ type: 'error', title: i18n.ts.loginFailed, diff --git a/packages/client/src/components/signup.vue b/packages/client/src/components/signup.vue index ec5be60a2..3f2af306e 100644 --- a/packages/client/src/components/signup.vue +++ b/packages/client/src/components/signup.vue @@ -111,7 +111,7 @@ export default defineComponent({ ToSAgreement: false, hCaptchaResponse: null, reCaptchaResponse: null, - } + }; }, computed: { diff --git a/packages/client/src/components/ui/button.vue b/packages/client/src/components/ui/button.vue index fe8f1c7cc..e6b20d988 100644 --- a/packages/client/src/components/ui/button.vue +++ b/packages/client/src/components/ui/button.vue @@ -96,11 +96,11 @@ export default defineComponent({ } function calcCircleScale(boxW, boxH, circleCenterX, circleCenterY) { - const origin = {x: circleCenterX, y: circleCenterY}; - const dist1 = distance({x: 0, y: 0}, origin); - const dist2 = distance({x: boxW, y: 0}, origin); - const dist3 = distance({x: 0, y: boxH}, origin); - const dist4 = distance({x: boxW, y: boxH }, origin); + const origin = { x: circleCenterX, y: circleCenterY }; + const dist1 = distance({ x: 0, y: 0 }, origin); + const dist2 = distance({ x: boxW, y: 0 }, origin); + const dist3 = distance({ x: 0, y: boxH }, origin); + const dist4 = distance({ x: boxW, y: boxH }, origin); return Math.max(dist1, dist2, dist3, dist4) * 2; } diff --git a/packages/client/src/components/ui/modal.vue b/packages/client/src/components/ui/modal.vue index 1e4159055..010262da2 100644 --- a/packages/client/src/components/ui/modal.vue +++ b/packages/client/src/components/ui/modal.vue @@ -234,7 +234,7 @@ onMounted(() => { } fixed.value = (type.value === 'drawer') || (getFixedContainer(props.src) != null); - await nextTick() + await nextTick(); align(); }, { immediate: true, }); diff --git a/packages/client/src/components/ui/tooltip.vue b/packages/client/src/components/ui/tooltip.vue index ee1909554..571d11ba3 100644 --- a/packages/client/src/components/ui/tooltip.vue +++ b/packages/client/src/components/ui/tooltip.vue @@ -63,7 +63,7 @@ const setPosition = () => { } return [left, top]; - } + }; const calcPosWhenBottom = () => { let left: number; @@ -84,7 +84,7 @@ const setPosition = () => { } return [left, top]; - } + }; const calcPosWhenLeft = () => { let left: number; @@ -105,7 +105,7 @@ const setPosition = () => { } return [left, top]; - } + }; const calcPosWhenRight = () => { let left: number; @@ -126,7 +126,7 @@ const setPosition = () => { } return [left, top]; - } + }; const calc = (): { left: number; @@ -172,7 +172,7 @@ const setPosition = () => { } return null as never; - } + }; const { left, top, transformOrigin } = calc(); el.value.style.transformOrigin = transformOrigin; diff --git a/packages/client/src/components/url-preview.vue b/packages/client/src/components/url-preview.vue index c7bbd1fbd..6c593c7b4 100644 --- a/packages/client/src/components/url-preview.vue +++ b/packages/client/src/components/url-preview.vue @@ -90,7 +90,7 @@ fetch(`/url?url=${encodeURIComponent(requestUrl.href)}&lang=${requestLang}`).the sitename = info.sitename; fetching = false; player = info.player; - }) + }); }); function adjustTweetHeight(message: any) { diff --git a/packages/client/src/directives/adaptive-border.ts b/packages/client/src/directives/adaptive-border.ts index fc426ca2c..619c9f0b6 100644 --- a/packages/client/src/directives/adaptive-border.ts +++ b/packages/client/src/directives/adaptive-border.ts @@ -9,7 +9,7 @@ export default { } else { return el.parentElement ? getBgColor(el.parentElement) : 'transparent'; } - } + }; const parentBg = getBgColor(src.parentElement); diff --git a/packages/client/src/directives/get-size.ts b/packages/client/src/directives/get-size.ts index 1fcd0718d..2c4e9c188 100644 --- a/packages/client/src/directives/get-size.ts +++ b/packages/client/src/directives/get-size.ts @@ -25,12 +25,12 @@ function calc(src: Element) { return; } if (info.intersection) { - info.intersection.disconnect() + info.intersection.disconnect(); delete info.intersection; - }; + } info.fn(width, height); -}; +} export default { mounted(src, binding, vn) { diff --git a/packages/client/src/directives/panel.ts b/packages/client/src/directives/panel.ts index 5f9158db2..d31dc41ed 100644 --- a/packages/client/src/directives/panel.ts +++ b/packages/client/src/directives/panel.ts @@ -9,7 +9,7 @@ export default { } else { return el.parentElement ? getBgColor(el.parentElement) : 'transparent'; } - } + }; const parentBg = getBgColor(src.parentElement); diff --git a/packages/client/src/directives/size.ts b/packages/client/src/directives/size.ts index 36f649f18..51855e0de 100644 --- a/packages/client/src/directives/size.ts +++ b/packages/client/src/directives/size.ts @@ -60,9 +60,9 @@ function calc(el: Element) { return; } if (info.intersection) { - info.intersection.disconnect() + info.intersection.disconnect(); delete info.intersection; - }; + } mountings.set(el, Object.assign(info, { previousWidth: width })); diff --git a/packages/client/src/os.ts b/packages/client/src/os.ts index 6baf53891..4f19fadf1 100644 --- a/packages/client/src/os.ts +++ b/packages/client/src/os.ts @@ -285,7 +285,7 @@ export function inputDate(props: { }); } -export function select(props: { +export function select(props: { title?: string | null; text?: string | null; default?: string | null; diff --git a/packages/client/src/pages/admin/emojis.vue b/packages/client/src/pages/admin/emojis.vue index 38bcc41ea..8ca5b3d65 100644 --- a/packages/client/src/pages/admin/emojis.vue +++ b/packages/client/src/pages/admin/emojis.vue @@ -159,7 +159,7 @@ const remoteMenu = (emoji, ev: MouseEvent) => { }, { text: i18n.ts.import, icon: 'fas fa-plus', - action: () => { im(emoji) } + action: () => { im(emoji); } }], ev.currentTarget ?? ev.target); }; diff --git a/packages/client/src/pages/admin/metrics.vue b/packages/client/src/pages/admin/metrics.vue index 1de297fd9..7e5f5bb09 100644 --- a/packages/client/src/pages/admin/metrics.vue +++ b/packages/client/src/pages/admin/metrics.vue @@ -132,7 +132,7 @@ export default defineComponent({ overviewHeight: '1fr', queueHeight: '1fr', paused: false, - } + }; }, computed: { diff --git a/packages/client/src/pages/admin/queue.vue b/packages/client/src/pages/admin/queue.vue index e05098082..656b18199 100644 --- a/packages/client/src/pages/admin/queue.vue +++ b/packages/client/src/pages/admin/queue.vue @@ -20,7 +20,7 @@ import * as symbols from '@/symbols'; import * as config from '@/config'; import { i18n } from '@/i18n'; -const connection = markRaw(stream.useChannel('queueStats')) +const connection = markRaw(stream.useChannel('queueStats')); function clear() { os.confirm({ @@ -41,7 +41,7 @@ onMounted(() => { length: 200 }); }); -}) +}); onBeforeUnmount(() => { connection.dispose(); diff --git a/packages/client/src/pages/auth.form.vue b/packages/client/src/pages/auth.form.vue index bc719aebd..5feff0149 100644 --- a/packages/client/src/pages/auth.form.vue +++ b/packages/client/src/pages/auth.form.vue @@ -32,7 +32,7 @@ export default defineComponent({ computed: { name(): string { const el = document.createElement('div'); - el.textContent = this.app.name + el.textContent = this.app.name; return el.innerHTML; }, app(): any { diff --git a/packages/client/src/pages/emojis.category.vue b/packages/client/src/pages/emojis.category.vue index 1be004cf5..c47870f4d 100644 --- a/packages/client/src/pages/emojis.category.vue +++ b/packages/client/src/pages/emojis.category.vue @@ -58,7 +58,7 @@ export default defineComponent({ tags: emojiTags, selectedTags: new Set(), searchEmojis: null, - } + }; }, watch: { diff --git a/packages/client/src/pages/federation.vue b/packages/client/src/pages/federation.vue index 5add2b532..447918905 100644 --- a/packages/client/src/pages/federation.vue +++ b/packages/client/src/pages/federation.vue @@ -127,7 +127,7 @@ function getStatus(instance) { if (instance.isSuspended) return 'suspended'; if (instance.isNotResponding) return 'error'; return 'alive'; -}; +} defineExpose({ [symbols.PAGE_INFO]: { diff --git a/packages/client/src/pages/gallery/edit.vue b/packages/client/src/pages/gallery/edit.vue index a0c2d1a59..bc87160c4 100644 --- a/packages/client/src/pages/gallery/edit.vue +++ b/packages/client/src/pages/gallery/edit.vue @@ -71,7 +71,7 @@ export default defineComponent({ description: null, title: null, isSensitive: false, - } + }; }, watch: { diff --git a/packages/client/src/pages/messaging/index.vue b/packages/client/src/pages/messaging/index.vue index 61c8bb0ce..7c1d3e3cb 100644 --- a/packages/client/src/pages/messaging/index.vue +++ b/packages/client/src/pages/messaging/index.vue @@ -123,11 +123,11 @@ export default defineComponent({ os.popupMenu([{ text: this.$ts.messagingWithUser, icon: 'fas fa-user', - action: () => { this.startUser() } + action: () => { this.startUser(); } }, { text: this.$ts.messagingWithGroup, icon: 'fas fa-users', - action: () => { this.startGroup() } + action: () => { this.startGroup(); } }], ev.currentTarget ?? ev.target); }, diff --git a/packages/client/src/pages/messaging/messaging-room.form.vue b/packages/client/src/pages/messaging/messaging-room.form.vue index ad8aaae6b..8e779c4f3 100644 --- a/packages/client/src/pages/messaging/messaging-room.form.vue +++ b/packages/client/src/pages/messaging/messaging-room.form.vue @@ -200,7 +200,7 @@ export default defineComponent({ text: this.text, file: this.file } - } + }; localStorage.setItem('message_drafts', JSON.stringify(drafts)); }, diff --git a/packages/client/src/pages/mfm-cheat-sheet.vue b/packages/client/src/pages/mfm-cheat-sheet.vue index aa35ec215..2c10494ed 100644 --- a/packages/client/src/pages/mfm-cheat-sheet.vue +++ b/packages/client/src/pages/mfm-cheat-sheet.vue @@ -341,7 +341,7 @@ export default defineComponent({ preview_rainbow: `$[rainbow 🍮] $[rainbow.speed=5s 🍮]`, preview_sparkle: `$[sparkle 🍮]`, preview_rotate: `$[rotate 🍮]`, - } + }; }, }); diff --git a/packages/client/src/pages/my-antennas/index.vue b/packages/client/src/pages/my-antennas/index.vue index 9f1e01f11..a568f64c5 100644 --- a/packages/client/src/pages/my-antennas/index.vue +++ b/packages/client/src/pages/my-antennas/index.vue @@ -32,7 +32,7 @@ defineExpose({ icon: 'fas fa-satellite', bg: 'var(--bg)' } -}) +});