From b1c4effefb4364734b48ddb26bc95240a203d164 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Thu, 11 Aug 2022 17:08:23 +0800 Subject: [PATCH] fix(gui-v2): lint --- packages/nc-gui-v2/components.d.ts | 1 + packages/nc-gui-v2/components/dlg/TableRename.vue | 2 +- packages/nc-gui-v2/composables/useViewData.ts | 12 ++++++------ packages/nc-gui-v2/composables/useViews.ts | 2 +- packages/nc-gui-v2/package.json | 2 +- packages/nc-gui-v2/pages/index/index.vue | 2 +- packages/nc-gui-v2/utils/index.ts | 1 + 7 files changed, 12 insertions(+), 10 deletions(-) diff --git a/packages/nc-gui-v2/components.d.ts b/packages/nc-gui-v2/components.d.ts index 1988ba1e72..7fd5ee4556 100644 --- a/packages/nc-gui-v2/components.d.ts +++ b/packages/nc-gui-v2/components.d.ts @@ -47,6 +47,7 @@ declare module '@vue/runtime-core' { ARow: typeof import('ant-design-vue/es')['Row'] ASelect: typeof import('ant-design-vue/es')['Select'] ASelectOption: typeof import('ant-design-vue/es')['SelectOption'] + ASkeleton: typeof import('ant-design-vue/es')['Skeleton'] ASkeletonImage: typeof import('ant-design-vue/es')['SkeletonImage'] ASpin: typeof import('ant-design-vue/es')['Spin'] ASubMenu: typeof import('ant-design-vue/es')['SubMenu'] diff --git a/packages/nc-gui-v2/components/dlg/TableRename.vue b/packages/nc-gui-v2/components/dlg/TableRename.vue index 30da9d2ef4..011e241099 100644 --- a/packages/nc-gui-v2/components/dlg/TableRename.vue +++ b/packages/nc-gui-v2/components/dlg/TableRename.vue @@ -3,7 +3,7 @@ import { watchEffect } from '@vue/runtime-core' import { Form, notification } from 'ant-design-vue' import type { TableType } from 'nocodb-sdk' import { useProject, useTabs } from '#imports' -import { extractSdkResponseErrorMsg, validateTableName } from '~/utils/errorUtils' +import { extractSdkResponseErrorMsg, validateTableName } from '~/utils' import { useNuxtApp } from '#app' interface Props { diff --git a/packages/nc-gui-v2/composables/useViewData.ts b/packages/nc-gui-v2/composables/useViewData.ts index 5202a9ed83..a49fdd4b25 100644 --- a/packages/nc-gui-v2/composables/useViewData.ts +++ b/packages/nc-gui-v2/composables/useViewData.ts @@ -1,4 +1,4 @@ -import type { Api, FormType, GalleryType, PaginatedType, TableType, ViewType } from 'nocodb-sdk' +import type { Api, FormType, ColumnType, GalleryType, PaginatedType, TableType, ViewType } from 'nocodb-sdk' import type { ComputedRef, Ref } from 'vue' import { notification } from 'ant-design-vue' import { useNuxtApp } from '#app' @@ -33,7 +33,7 @@ export function useViewData( const formattedData = ref([]) const paginationData = ref({ page: 1, pageSize: 25 }) - const aggCommentCount = ref>({}) + const aggCommentCount = ref[]>([]) const galleryData = ref(undefined) const formColumnData = ref(undefined) const formViewData = ref(undefined) @@ -43,10 +43,10 @@ export function useViewData( const selectedAllRecords = computed({ get() { - return formattedData.value.every((row) => row.rowMeta.selected) + return formattedData.value.every((row: Record) => row.rowMeta.selected) }, set(selected) { - formattedData.value.forEach((row) => (row.rowMeta.selected = selected)) + formattedData.value.forEach((row: Record) => (row.rowMeta.selected = selected)) }, }) @@ -88,7 +88,7 @@ export function useViewData( for (const row of formattedData.value) { const id = extractPkFromRow(row.row, meta?.value?.columns as ColumnType[]) - row.rowMeta.commentCount = aggCommentCount.value?.find((c) => c.row_id === id)?.count || 0 + row.rowMeta.commentCount = aggCommentCount.value?.find((c: Record) => c.row_id === id)?.count || 0 } } @@ -261,7 +261,7 @@ export function useViewData( let row = formattedData.value.length while (row--) { try { - const { row: rowObj, rowMeta } = formattedData.value[row] + const { row: rowObj, rowMeta } = formattedData.value[row] as Record if (!rowMeta.selected) { continue } diff --git a/packages/nc-gui-v2/composables/useViews.ts b/packages/nc-gui-v2/composables/useViews.ts index 854852f003..da31a37944 100644 --- a/packages/nc-gui-v2/composables/useViews.ts +++ b/packages/nc-gui-v2/composables/useViews.ts @@ -12,7 +12,7 @@ export function useViews(meta: MaybeRef) { if (_meta && _meta.id) { const response = (await $api.dbView.list(_meta.id)).list if (response) { - views = response.sort((a, b) => a.order! - b.order!) + // views = response.sort((a, b) => a.order! - b.order!) } } } diff --git a/packages/nc-gui-v2/package.json b/packages/nc-gui-v2/package.json index 9bd7b93ff2..fae85f7719 100644 --- a/packages/nc-gui-v2/package.json +++ b/packages/nc-gui-v2/package.json @@ -26,9 +26,9 @@ "socket.io-client": "^4.5.1", "sortablejs": "^1.15.0", "unique-names-generator": "^4.7.1", - "vue-dompurify-html": "^3.0.0", "url": "^0.11.0", "util": "^0.12.4", + "vue-dompurify-html": "^3.0.0", "vue-i18n": "^9.1.10", "vue-toastification": "^2.0.0-rc.5", "vuedraggable": "^4.1.0", diff --git a/packages/nc-gui-v2/pages/index/index.vue b/packages/nc-gui-v2/pages/index/index.vue index 6fcd226eb2..cf031a6a13 100644 --- a/packages/nc-gui-v2/pages/index/index.vue +++ b/packages/nc-gui-v2/pages/index/index.vue @@ -42,7 +42,7 @@ const deleteProject = (project: ProjectType) => { async onOk() { try { $e('c:project:delete') - await $api.project.delete(project.id as string) + await api.project.delete(project.id as string) return projects.value?.splice(projects.value.indexOf(project), 1) } catch (e: any) { return notification.error({ diff --git a/packages/nc-gui-v2/utils/index.ts b/packages/nc-gui-v2/utils/index.ts index b133011efe..2b2e7fa724 100644 --- a/packages/nc-gui-v2/utils/index.ts +++ b/packages/nc-gui-v2/utils/index.ts @@ -16,3 +16,4 @@ export * from './validation' export * from './viewUtils' export * from './currencyUtils' export * from './dataUtils' +export * from './userUtils'