From 8a7fd6b593f1e34bddab053be22040d41c57dd73 Mon Sep 17 00:00:00 2001 From: naskya Date: Sat, 13 Jan 2024 15:28:17 +0900 Subject: [PATCH] chore: lint --- packages/backend/native-utils/src/util/id.rs | 2 +- packages/client/assets/tagcanvas.min.js | 4 +- .../client/src/components/MkContextMenu.vue | 12 ++--- packages/client/src/components/MkModal.vue | 22 ++++----- packages/client/src/components/MkPostForm.vue | 6 +-- .../client/src/components/MkPullToRefresh.vue | 3 +- .../src/components/MkReleaseNotesWindow.vue | 2 +- .../src/components/MkSimpleTextWindow.vue | 2 +- packages/client/src/components/MkTimeline.vue | 6 ++- .../src/components/MkUrlPreviewPopup.vue | 4 +- .../client/src/components/MkUserPreview.vue | 4 +- .../client/src/components/global/MkAvatar.vue | 6 +-- packages/client/src/components/mfm.ts | 7 ++- .../client/src/directives/follow-append.ts | 2 +- packages/client/src/directives/hotkey.ts | 2 +- packages/client/src/directives/ripple.ts | 2 +- packages/client/src/directives/tooltip.ts | 4 +- .../client/src/directives/user-preview.ts | 2 +- packages/client/src/directives/vibrate.ts | 2 +- packages/client/src/filters/user.ts | 2 +- packages/client/src/init.ts | 8 ++-- packages/client/src/pages/about-firefish.vue | 2 +- packages/client/src/pages/drive.vue | 6 ++- packages/client/src/pages/search.vue | 2 +- packages/client/src/pages/timeline.vue | 2 +- packages/client/src/pages/user/home.vue | 4 +- packages/client/src/router.ts | 3 +- packages/client/src/scripts/aiscript/api.ts | 2 +- packages/client/src/scripts/autocomplete.ts | 2 +- packages/client/src/scripts/emojilist.ts | 2 +- .../src/scripts/extract-url-from-mfm.ts | 2 +- .../client/src/scripts/gen-search-query.ts | 2 +- packages/client/src/scripts/get-note-menu.ts | 8 ++-- packages/client/src/scripts/get-user-menu.ts | 4 +- packages/client/src/scripts/hpml/evaluator.ts | 8 ++-- packages/client/src/scripts/hpml/index.ts | 2 +- packages/client/src/scripts/hpml/lib.ts | 4 +- .../client/src/scripts/hpml/type-checker.ts | 4 +- packages/client/src/scripts/lookup-user.ts | 2 +- packages/client/src/scripts/please-login.ts | 2 +- packages/client/src/scripts/popout.ts | 2 +- packages/client/src/scripts/popup-position.ts | 45 +++++++++---------- packages/client/src/scripts/preprocess.ts | 2 +- .../client/src/scripts/reaction-picker.ts | 2 +- packages/client/src/scripts/select-file.ts | 4 +- packages/client/src/scripts/shuffle.ts | 2 +- packages/client/src/scripts/theme.ts | 2 +- packages/client/src/scripts/upload.ts | 6 +-- .../client/src/scripts/use-chart-tooltip.ts | 8 ++-- .../client/src/scripts/use-note-capture.ts | 6 +-- packages/client/src/stream.ts | 2 +- .../src/ui/_common_/stream-indicator.vue | 2 +- packages/client/src/ui/deck/deck-store.ts | 4 +- packages/client/src/ui/deck/tl-column.vue | 2 +- packages/client/src/widgets/widget.ts | 4 +- packages/firefish-js/src/api.types.ts | 10 ++--- packages/firefish-js/src/index.ts | 4 +- packages/firefish-js/src/streaming.ts | 6 +-- 58 files changed, 136 insertions(+), 144 deletions(-) diff --git a/packages/backend/native-utils/src/util/id.rs b/packages/backend/native-utils/src/util/id.rs index 2fd94e90..9d1427e6 100644 --- a/packages/backend/native-utils/src/util/id.rs +++ b/packages/backend/native-utils/src/util/id.rs @@ -21,7 +21,7 @@ const TIME_2000: i64 = 946_684_800_000; const TIMESTAMP_LENGTH: u16 = 8; /// Initializes Cuid2 generator. Must be called before any [create_id]. -pub fn init_id<'a>(length: u16, fingerprint: &'a str) { +pub fn init_id(length: u16, fingerprint: &str) { FINGERPRINT.get_or_init(move || format!("{}{}", fingerprint, cuid2::create_id())); GENERATOR.get_or_init(move || { cuid2::CuidConstructor::new() diff --git a/packages/client/assets/tagcanvas.min.js b/packages/client/assets/tagcanvas.min.js index 2a19f5c1..f8476f43 100644 --- a/packages/client/assets/tagcanvas.min.js +++ b/packages/client/assets/tagcanvas.min.js @@ -968,8 +968,8 @@ a = c.documentElement, d = c.body, e = window, - h = e.pageXOffset || a.scrollLeft, - i = e.pageYOffset || a.scrollTop, + h = e.scrollX || a.scrollLeft, + i = e.scrollY || a.scrollTop, j = a.clientLeft || d.clientLeft, k = a.clientTop || d.clientTop; return { x: b.left + h - j, y: b.top + i - k }; diff --git a/packages/client/src/components/MkContextMenu.vue b/packages/client/src/components/MkContextMenu.vue index 3944719f..319f7fd0 100644 --- a/packages/client/src/components/MkContextMenu.vue +++ b/packages/client/src/components/MkContextMenu.vue @@ -33,18 +33,18 @@ const rootEl = ref(); const zIndex = ref(os.claimZIndex("high")); onMounted(() => { - let left = props.ev.pageX + 1, // 間違って右ダブルクリックした場合に意図せずアイテムがクリックされるのを防ぐため + 1 - top = props.ev.pageY + 1; // 間違って右ダブルクリックした場合に意図せずアイテムがクリックされるのを防ぐため + 1 + let left = props.ev.pageX + 1; // 間違って右ダブルクリックした場合に意図せずアイテムがクリックされるのを防ぐため + 1 + let top = props.ev.pageY + 1; // 間違って右ダブルクリックした場合に意図せずアイテムがクリックされるのを防ぐため + 1 const width = rootEl.value.offsetWidth; const height = rootEl.value.offsetHeight; - if (left + width - window.pageXOffset > window.innerWidth) { - left = window.innerWidth - width + window.pageXOffset; + if (left + width - window.scrollX > window.innerWidth) { + left = window.innerWidth - width + window.scrollX; } - if (top + height - window.pageYOffset > window.innerHeight) { - top = window.innerHeight - height + window.pageYOffset; + if (top + height - window.scrollY > window.innerHeight) { + top = window.innerHeight - height + window.scrollY; } if (top < 0) { diff --git a/packages/client/src/components/MkModal.vue b/packages/client/src/components/MkModal.vue index f3476b7f..1186b04c 100644 --- a/packages/client/src/components/MkModal.vue +++ b/packages/client/src/components/MkModal.vue @@ -237,8 +237,8 @@ const align = () => { let left, top; - const x = srcRect.left + (fixed.value ? 0 : window.pageXOffset); - const y = srcRect.top + (fixed.value ? 0 : window.pageYOffset); + const x = srcRect.left + (fixed.value ? 0 : window.scrollX); + const y = srcRect.top + (fixed.value ? 0 : window.scrollY); if (props.anchor.x === "center") { left = x + props.src.offsetWidth / 2 - width / 2; @@ -286,8 +286,7 @@ const align = () => { left = window.innerWidth - width + window.scrollX - 1; } - const underSpace = - window.innerHeight - MARGIN - (top - window.pageYOffset); + const underSpace = window.innerHeight - MARGIN - (top - window.scrollY); const upperSpace = srcRect.top - MARGIN; // 画面から縦にはみ出る場合 @@ -300,12 +299,7 @@ const align = () => { top = window.scrollY + (upperSpace + MARGIN - height); } } else { - top = - window.innerHeight - - MARGIN - - height + - window.pageYOffset - - 1; + top = window.innerHeight - MARGIN - height + window.scrollY - 1; } } else { maxHeight.value = underSpace; @@ -327,12 +321,12 @@ const align = () => { top >= srcRect.top + props.src.offsetHeight + - (fixed.value ? 0 : window.pageYOffset) + (fixed.value ? 0 : window.scrollY) ) { transformOriginY = "top"; } else if ( top + height <= - srcRect.top + (fixed.value ? 0 : window.pageYOffset) + srcRect.top + (fixed.value ? 0 : window.scrollY) ) { transformOriginY = "bottom"; } @@ -341,12 +335,12 @@ const align = () => { left >= srcRect.left + props.src.offsetWidth + - (fixed.value ? 0 : window.pageXOffset) + (fixed.value ? 0 : window.scrollX) ) { transformOriginX = "left"; } else if ( left + width <= - srcRect.left + (fixed.value ? 0 : window.pageXOffset) + srcRect.left + (fixed.value ? 0 : window.scrollX) ) { transformOriginX = "right"; } diff --git a/packages/client/src/components/MkPostForm.vue b/packages/client/src/components/MkPostForm.vue index db1c964c..80a5c4a5 100644 --- a/packages/client/src/components/MkPostForm.vue +++ b/packages/client/src/components/MkPostForm.vue @@ -309,7 +309,7 @@ import { deepClone } from "@/scripts/clone"; import preprocess from "@/scripts/preprocess"; import { vibrate } from "@/scripts/vibrate"; import { langmap } from "@/scripts/langmap"; -import { MenuItem } from "@/types/menu"; +import type { MenuItem } from "@/types/menu"; import detectLanguage from "@/scripts/detect-language"; import icon from "@/scripts/icon"; @@ -747,8 +747,8 @@ function filterLangmapByPrefix( if (prefix === "zh") to_return = to_return.concat([ - { langCode: "yue", nativeName: langmap["yue"].nativeName }, - { langCode: "nan", nativeName: langmap["nan"].nativeName }, + { langCode: "yue", nativeName: langmap.yue.nativeName }, + { langCode: "nan", nativeName: langmap.nan.nativeName }, ]); return to_return; diff --git a/packages/client/src/components/MkPullToRefresh.vue b/packages/client/src/components/MkPullToRefresh.vue index 4aa984c5..c7b09a91 100644 --- a/packages/client/src/components/MkPullToRefresh.vue +++ b/packages/client/src/components/MkPullToRefresh.vue @@ -45,7 +45,6 @@ const isRefreshing = ref(false); const pullDistance = ref(0); let disabled = false; - let supportPointerDesktop = false; let startScreenY: number | null = null; @@ -94,7 +93,7 @@ function moveBySystem(to: number): Promise { return; } const startTime = Date.now(); - let intervalId = setInterval(() => { + const intervalId = setInterval(() => { const time = Date.now() - startTime; if (time > RELEASE_TRANSITION_DURATION) { pullDistance.value = to; diff --git a/packages/client/src/components/MkReleaseNotesWindow.vue b/packages/client/src/components/MkReleaseNotesWindow.vue index 72060e81..fef29fcd 100644 --- a/packages/client/src/components/MkReleaseNotesWindow.vue +++ b/packages/client/src/components/MkReleaseNotesWindow.vue @@ -4,8 +4,8 @@ :can-resize="true" :front="true" :buttons-right="buttonsRight" - @closed="emit('closed')" class="oxzftdfc" + @closed="emit('closed')" >