From 3e3bb02b5f6c30ec8ad677066d8292683273356b Mon Sep 17 00:00:00 2001 From: Amir Raminfar Date: Mon, 17 Mar 2025 09:20:04 -0700 Subject: [PATCH] chore: fixes code suggestions (#3708) --- assets/components/ContainerViewer/ContainerTitle.vue | 6 +++--- assets/components/LogViewer/LogDetails.vue | 4 ++-- assets/components/LogViewer/SimpleLogItem.vue | 2 +- assets/composable/profileStorage.ts | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/assets/components/ContainerViewer/ContainerTitle.vue b/assets/components/ContainerViewer/ContainerTitle.vue index 3dd231ca..cc4e9150 100644 --- a/assets/components/ContainerViewer/ContainerTitle.vue +++ b/assets/components/ContainerViewer/ContainerTitle.vue @@ -62,9 +62,9 @@ const store = useContainerStore(); const { containers: allContainers } = storeToRefs(store); const otherContainers = computed(() => - [...allContainers.value.filter((c) => c.name === container.name && c.id !== container.id)].sort( - (a, b) => +b.created - +a.created, - ), + allContainers.value + .filter((c) => c.name === container.name && c.id !== container.id) + .sort((a, b) => +b.created - +a.created), ); const wrapper = useTemplateRef("wrapper"); diff --git a/assets/components/LogViewer/LogDetails.vue b/assets/components/LogViewer/LogDetails.vue index e238e285..f6db908a 100644 --- a/assets/components/LogViewer/LogDetails.vue +++ b/assets/components/LogViewer/LogDetails.vue @@ -146,8 +146,8 @@ function syntaxHighlight(json: any) { /("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|\b\d+\b)/g, function (match: string) { var cls = "json-number"; - if (/^"/.test(match)) { - if (/:$/.test(match)) { + if (match.startsWith('"')) { + if (match.endsWith(":")) { cls = "json-key"; } else { cls = "json-string"; diff --git a/assets/components/LogViewer/SimpleLogItem.vue b/assets/components/LogViewer/SimpleLogItem.vue index f8b39872..77efa990 100644 --- a/assets/components/LogViewer/SimpleLogItem.vue +++ b/assets/components/LogViewer/SimpleLogItem.vue @@ -29,7 +29,7 @@ defineProps<{ const colorize = (value: string) => ansiConvertor.toHtml(value); const urlPattern = - /https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b[-a-zA-Z0-9()@:%_+.~#?&\/=]*/g; + /https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b[-a-zA-Z0-9()@:%_+.~#?&/=]*/g; const linkify = (text: string) => text.replace(urlPattern, (url) => `${url}`); diff --git a/assets/composable/profileStorage.ts b/assets/composable/profileStorage.ts index 7b70990d..8e081a19 100644 --- a/assets/composable/profileStorage.ts +++ b/assets/composable/profileStorage.ts @@ -29,7 +29,7 @@ export function useProfileStorage( if (transformer) { storage.value = transformer.from(config.profile[key]); } else if (storage.value instanceof Set && config.profile[key] instanceof Array) { - storage.value = new Set([...(config.profile[key] as Iterable)]) as unknown as NonNullable; + storage.value = new Set(config.profile[key] as Iterable) as unknown as NonNullable; } else if (config.profile[key] instanceof Array) { storage.value = config.profile[key] as NonNullable; } else if (config.profile[key] instanceof Object) {