From 6b91b2155ae501bf058af5fd220b07c9fc3faef8 Mon Sep 17 00:00:00 2001 From: DebugIsFalse <511418503@qq.com> Date: Tue, 11 Jun 2024 19:01:15 +0800 Subject: [PATCH] fix: eslint --- archive/Process.vue | 2 +- archive/SearchHistory.vue | 6 ++--- components/color-picker/ColorPicker.vue | 14 +++++++---- components/color-picker/ColorPickerPill.vue | 4 ++-- components/i/Confirm.vue | 2 +- components/i/Create.vue | 3 ++- components/i/SearchHistory.vue | 3 ++- components/i/Sign.vue | 2 +- components/i/action/Collect.vue | 2 +- components/i/action/Thread.vue | 12 +++++----- components/i/library/Create.vue | 2 +- components/i/library/Edit.vue | 2 +- components/i/library/Header.vue | 4 ++-- components/i/library/Select.vue | 11 +++++---- components/i/library/Thread.vue | 7 +++--- components/i/md/mdc.vue | 3 ++- components/i/search/Ask.vue | 2 +- components/i/search/Content.vue | 8 ++++--- components/i/search/ExtraInfo.vue | 3 ++- components/i/search/Header.vue | 2 +- components/i/search/Process.vue | 2 +- components/i/search/RecommendQuestion.vue | 2 +- components/i/search/Title.vue | 2 +- components/prose/Chart.global.vue | 4 ++-- composables/useCollectionRequest.js | 14 +++++------ composables/useRequestError.js | 2 +- eslint.config.mjs | 4 ++-- pages/library/index.vue | 2 +- pages/search/[id].vue | 26 +++++++++++---------- utils/searchUtil.js | 8 +++---- 30 files changed, 88 insertions(+), 72 deletions(-) diff --git a/archive/Process.vue b/archive/Process.vue index c25229c..1570735 100644 --- a/archive/Process.vue +++ b/archive/Process.vue @@ -74,6 +74,6 @@ watch(() => props.collapse, () => { handleCollapse(false) }, 500) } -}, { immediate: true}) +}, { immediate: true }) defineExpose({ handleCollapse }) diff --git a/archive/SearchHistory.vue b/archive/SearchHistory.vue index e120659..b2f7d83 100644 --- a/archive/SearchHistory.vue +++ b/archive/SearchHistory.vue @@ -87,7 +87,7 @@ \ No newline at end of file diff --git a/components/i/Confirm.vue b/components/i/Confirm.vue index 46c555c..cb1653a 100644 --- a/components/i/Confirm.vue +++ b/components/i/Confirm.vue @@ -32,7 +32,7 @@ defineProps({ default: false } }) -const emits = defineEmits(['success', 'cancel']) +const emits = defineEmits([ 'success', 'cancel' ]) function handleCancel () { emits('cancel') } diff --git a/components/i/Create.vue b/components/i/Create.vue index 209c1be..52b444f 100644 --- a/components/i/Create.vue +++ b/components/i/Create.vue @@ -17,7 +17,8 @@
-
-
diff --git a/components/i/library/Create.vue b/components/i/library/Create.vue index ef7e866..bfdc02d 100644 --- a/components/i/library/Create.vue +++ b/components/i/library/Create.vue @@ -70,7 +70,7 @@ const { $closeLibraryCreate, $getCollection } = useLibraryStore() const { setOrUpdateCollection } = useCollectionRequest() const props = defineProps({ id: { - type: [String, Number], + type: [ String, Number ], default: '' } }) diff --git a/components/i/library/Edit.vue b/components/i/library/Edit.vue index 71dd9c2..4f4ba68 100644 --- a/components/i/library/Edit.vue +++ b/components/i/library/Edit.vue @@ -4,7 +4,7 @@ diff --git a/components/i/search/RecommendQuestion.vue b/components/i/search/RecommendQuestion.vue index d8dfd6b..99540da 100644 --- a/components/i/search/RecommendQuestion.vue +++ b/components/i/search/RecommendQuestion.vue @@ -26,7 +26,7 @@ defineProps({ default: () => [] } }) -const emits = defineEmits(['click']) +const emits = defineEmits([ 'click' ]) function handleClick(title) { emits('click', title) } diff --git a/components/i/search/Title.vue b/components/i/search/Title.vue index 9a491fb..03d01ac 100644 --- a/components/i/search/Title.vue +++ b/components/i/search/Title.vue @@ -12,7 +12,7 @@ const props = defineProps({ default: '' }, id: { - type: [String, Number], + type: [ String, Number ], default: '' } }) diff --git a/components/prose/Chart.global.vue b/components/prose/Chart.global.vue index 8391d6b..a0ae204 100644 --- a/components/prose/Chart.global.vue +++ b/components/prose/Chart.global.vue @@ -45,8 +45,8 @@ function init () { datasets: props.data.map(item => { // item.backgroundColor = ['rgba(54, 162, 235, 0.2)', 'rgba(255, 99, 132, 0.2)', 'rgba(255, 159, 64, 0.2)', 'rgba(255, 205, 86, 0.2)', 'rgba(75, 192, 192, 0.2)', 'rgba(153, 102, 255, 0.2)', 'rgba(201, 203, 207, 0.2)'] // item.borderColor = ['rgb(54, 162, 235)', 'rgb(255, 99, 132)', 'rgb(255, 159, 64)', 'rgb(255, 205, 86)', 'rgb(75, 192, 192)', 'rgb(153, 102, 255)', 'rgb(201, 203, 207)'] - item.backgroundColor = ['rgba(54, 162, 235, 0.2)'] - item.borderColor = ['rgb(54, 162, 235)'] + item.backgroundColor = [ 'rgba(54, 162, 235, 0.2)' ] + item.borderColor = [ 'rgb(54, 162, 235)' ] item.borderWidth = 1 return item }) diff --git a/composables/useCollectionRequest.js b/composables/useCollectionRequest.js index b0c1f87..ab9b2d5 100644 --- a/composables/useCollectionRequest.js +++ b/composables/useCollectionRequest.js @@ -9,7 +9,7 @@ export default () => { * description string * */ - const {data, error} = await useRequest('/v1/collection/merge', { + const { data, error } = await useRequest('/v1/collection/merge', { method: 'post', body }) @@ -17,7 +17,7 @@ export default () => { } // 删除收藏夹 const deleteCollection = async (collection_id) => { - const {data, error} = await useRequest(`/v1/collection/${collection_id}/remove`, { + const { data, error } = await useRequest(`/v1/collection/${collection_id}/remove`, { method: 'post' }) return { data, error } @@ -26,7 +26,7 @@ export default () => { const saveCollection = async (body) => { // collection_id number 收藏夹ID // c_id string 会话ID - const {data, error} = await useRequest(`/v1/collection/item/add`, { + const { data, error } = await useRequest('/v1/collection/item/add', { method: 'post', body }) @@ -34,7 +34,7 @@ export default () => { } // 查询收藏夹会话列表 const findCollection = async (collection_id) => { - const {data, error} = await useRequest(`/v1/collection/${collection_id}/items`) + const { data, error } = await useRequest(`/v1/collection/${collection_id}/items`) if (error.value) { return [] } @@ -42,7 +42,7 @@ export default () => { } // 删除收藏夹会话 const deleteCollectionRecord = async (collection_id, c_id) => { - const {data, error} = await useRequest(`/v1/collection/item/delete`, { + const { data, error } = await useRequest('/v1/collection/item/delete', { method: 'post', body: { collection_id, c_id } }) @@ -51,12 +51,12 @@ export default () => { } // 查询会话是否被收藏 const findRecordCollection = async (c_id) => { - const {data, error} = await useRequest(`/v1/collection/item/check/${c_id}`) + const { data, error } = await useRequest(`/v1/collection/item/check/${c_id}`) return { data, error } } const deleteThread = async (ids) => { - const {data, error} = await useRequest('/v1/chat/completion/remove', { + const { data, error } = await useRequest('/v1/chat/completion/remove', { method: 'post', body: ids }) diff --git a/composables/useRequestError.js b/composables/useRequestError.js index 31e2578..fcb6c1a 100644 --- a/composables/useRequestError.js +++ b/composables/useRequestError.js @@ -1,5 +1,5 @@ export default function (status, message) { - if (import.meta.client && [400, 401, 403].includes(status)) { + if (import.meta.client && [ 400, 401, 403 ].includes(status)) { // 全局弹提示 let title if (status === 400) title = message diff --git a/eslint.config.mjs b/eslint.config.mjs index 96989c2..7f753ff 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -3,7 +3,7 @@ import withNuxt from './.nuxt/eslint.config.mjs' export default withNuxt({ files: ['**/*.vue', '**/*.js'], - + ignores: ['node_modules/**'], rules: { 'semi': [0], 'vue/html-indent': ['off'], @@ -20,6 +20,6 @@ export default withNuxt({ // 关键字后面是否要空一格 'keyword-spacing': [2, { 'before': true, 'after': true }], // 强制最后一行空行 - 'no-multiple-empty-lines': ['error', { 'max': 2,'maxEOF': 1 }] + 'no-multiple-empty-lines': ['error', { 'max': 2, 'maxEOF': 1 }], } }) diff --git a/pages/library/index.vue b/pages/library/index.vue index 674af40..449218c 100644 --- a/pages/library/index.vue +++ b/pages/library/index.vue @@ -39,7 +39,7 @@