From 935fce338ab032e7acc41a3dd75f95f0e9ab1689 Mon Sep 17 00:00:00 2001 From: Johann150 Date: Mon, 4 Jul 2022 16:17:07 +0200 Subject: [PATCH 1/6] refactor: remove unnecessary computed Fixes lint no-const-assign. --- packages/client/src/pages/admin/bot-protection.vue | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/packages/client/src/pages/admin/bot-protection.vue b/packages/client/src/pages/admin/bot-protection.vue index d2e7919b4..d316f973b 100644 --- a/packages/client/src/pages/admin/bot-protection.vue +++ b/packages/client/src/pages/admin/bot-protection.vue @@ -61,27 +61,22 @@ let hcaptchaSecretKey: string | null = $ref(null); let recaptchaSiteKey: string | null = $ref(null); let recaptchaSecretKey: string | null = $ref(null); -const enableHcaptcha = $computed(() => provider === 'hcaptcha'); -const enableRecaptcha = $computed(() => provider === 'recaptcha'); - async function init() { const meta = await os.api('admin/meta'); - enableHcaptcha = meta.enableHcaptcha; hcaptchaSiteKey = meta.hcaptchaSiteKey; hcaptchaSecretKey = meta.hcaptchaSecretKey; - enableRecaptcha = meta.enableRecaptcha; recaptchaSiteKey = meta.recaptchaSiteKey; recaptchaSecretKey = meta.recaptchaSecretKey; - provider = enableHcaptcha ? 'hcaptcha' : enableRecaptcha ? 'recaptcha' : null; + provider = meta.enableHcaptcha ? 'hcaptcha' : meta.enableRecaptcha ? 'recaptcha' : null; } function save() { os.apiWithDialog('admin/update-meta', { - enableHcaptcha, + enableHcaptcha: provider === 'hcaptcha', hcaptchaSiteKey, hcaptchaSecretKey, - enableRecaptcha, + enableRecaptcha: provider === 'recaptcha', recaptchaSiteKey, recaptchaSecretKey, }).then(() => { From 2bd4323b17a65ded8e86fd0faf59b2d8321b3dbe Mon Sep 17 00:00:00 2001 From: Johann150 Date: Mon, 4 Jul 2022 16:22:11 +0200 Subject: [PATCH 2/6] fix lint: use let instead of const for $ref Fixes lint no-const-assign. --- packages/client/src/pages/admin/overview.user.vue | 2 +- packages/client/src/pages/gallery/post.vue | 4 ++-- packages/client/src/pages/theme-editor.vue | 2 +- packages/client/src/ui/classic.vue | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/client/src/pages/admin/overview.user.vue b/packages/client/src/pages/admin/overview.user.vue index 40592b280..d70336f3c 100644 --- a/packages/client/src/pages/admin/overview.user.vue +++ b/packages/client/src/pages/admin/overview.user.vue @@ -19,7 +19,7 @@ const props = defineProps<{ user: misskey.entities.User; }>(); -const chart = $ref(null); +let chart = $ref(null); os.apiGet('charts/user/notes', { userId: props.user.id, limit: 16, span: 'day' }).then(res => { chart = res; diff --git a/packages/client/src/pages/gallery/post.vue b/packages/client/src/pages/gallery/post.vue index e16ccc315..e87a541e9 100644 --- a/packages/client/src/pages/gallery/post.vue +++ b/packages/client/src/pages/gallery/post.vue @@ -74,8 +74,8 @@ const props = defineProps<{ postId: string; }>(); -const post = $ref(null); -const error = $ref(null); +let post = $ref(null); +let error = $ref(null); const otherPostsPagination = { endpoint: 'users/gallery/posts' as const, limit: 6, diff --git a/packages/client/src/pages/theme-editor.vue b/packages/client/src/pages/theme-editor.vue index cec383359..d0a26c9cf 100644 --- a/packages/client/src/pages/theme-editor.vue +++ b/packages/client/src/pages/theme-editor.vue @@ -118,7 +118,7 @@ const fgColors = [ { color: 'pink', forLight: '#84667d', forDark: '#e4d1e0', forPreview: '#b12390' }, ]; -const theme = $ref>({ +let theme = $ref>({ base: 'light', props: lightTheme.props, }); diff --git a/packages/client/src/ui/classic.vue b/packages/client/src/ui/classic.vue index 310232aec..a2c26f536 100644 --- a/packages/client/src/ui/classic.vue +++ b/packages/client/src/ui/classic.vue @@ -60,8 +60,8 @@ const DESKTOP_THRESHOLD = 1100; let isDesktop = $ref(window.innerWidth >= DESKTOP_THRESHOLD); let pageMetadata = $ref>(); -const widgetsShowing = $ref(false); -const fullView = $ref(false); +let widgetsShowing = $ref(false); +let fullView = $ref(false); let globalHeaderHeight = $ref(0); const wallpaper = localStorage.getItem('wallpaper') != null; const showMenuOnTop = $computed(() => defaultStore.state.menuDisplay === 'top'); From a5c3fcea6e9b4796cdeeb12655e72cab00a2255b Mon Sep 17 00:00:00 2001 From: Johann150 Date: Mon, 4 Jul 2022 16:33:55 +0200 Subject: [PATCH 3/6] fix lint no-undef --- packages/client/src/components/code-core.vue | 2 +- packages/client/src/pages/admin/_header_.vue | 1 - packages/client/src/pages/my-antennas/editor.vue | 1 + packages/client/src/pages/my-lists/list.vue | 1 + packages/client/src/pages/theme-editor.vue | 1 + packages/client/src/ui/deck/main-column.vue | 2 +- 6 files changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/client/src/components/code-core.vue b/packages/client/src/components/code-core.vue index 45a38afe0..65dee5cda 100644 --- a/packages/client/src/components/code-core.vue +++ b/packages/client/src/components/code-core.vue @@ -5,7 +5,7 @@