From 9b60bb7ed4afb6e35289b5e8581b298f80b81203 Mon Sep 17 00:00:00 2001 From: Coffee-crocodile <1147347984@qq.com> Date: Fri, 16 Jun 2023 11:36:17 +0800 Subject: [PATCH] style(project): eslint fix style --- build/config/proxy.ts | 1 + build/plugins/index.ts | 5 +++-- build/plugins/unplugin.ts | 2 +- build/plugins/vue.ts | 7 +++++-- package.json | 6 +++--- src/App.vue | 8 +++++--- src/components/common/DarkModeSwitch.vue | 1 + src/components/common/appLoading.vue | 1 + src/components/custom/QRCode.vue | 4 +++- src/config/service.ts | 1 + src/hooks/useSystem.ts | 4 ++-- src/layouts/components/header/FullScreen.vue | 1 + src/layouts/components/header/Github.vue | 3 ++- src/layouts/components/header/Reload.vue | 3 ++- src/layouts/components/header/Search.vue | 3 ++- src/layouts/components/header/Setting.vue | 3 ++- src/layouts/components/header/UserCenter.vue | 2 +- src/layouts/components/sider/Logo.vue | 1 + src/router/guard/index.ts | 3 +-- src/service/api/login.ts | 2 +- src/store/modules/route.ts | 6 ++++-- src/typings/global.d.ts | 8 ++++---- src/typings/route.d.ts | 2 +- src/views/list/commonList/index.vue | 2 +- src/views/plugin/editor/md/index.vue | 1 + src/views/plugin/editor/rich/index.vue | 2 +- src/views/test/test1/index.vue | 20 ++++++++++---------- src/views/test/test2/index.vue | 1 + src/views/test/test3/test4/index.vue | 2 +- unocss.config.ts | 2 +- 30 files changed, 64 insertions(+), 43 deletions(-) diff --git a/build/config/proxy.ts b/build/config/proxy.ts index 0c3b6d7..478e973 100644 --- a/build/config/proxy.ts +++ b/build/config/proxy.ts @@ -1,4 +1,5 @@ import type { ProxyOptions } from 'vite' + /** * @description: 生成vite代理字段 * @param {*} env - 环境变量配置 diff --git a/build/plugins/index.ts b/build/plugins/index.ts index de3c34c..c456aba 100644 --- a/build/plugins/index.ts +++ b/build/plugins/index.ts @@ -1,11 +1,12 @@ import type { PluginOption } from 'vite' -import UnoCSS from '@unocss/vite' +import UnoCSS from '@unocss/vite' import vueSetupExtend from 'vite-plugin-vue-setup-extend' import vue from './vue' import compress from './compress' import visualizer from './visualizer' import unplugin from './unplugin' import mock from './mock' + // import { viteMockServe } from 'vite-plugin-mock' // https://github.com/vbenjs/vite-plugin-mock/blob/main/README.zh_CN.md /** @@ -14,7 +15,7 @@ import mock from './mock' * @return {*} */ export function setVitePlugins(env: ImportMetaEnv) { - const plugins: PluginOption[] = [...vue, UnoCSS(), ...unplugin,mock, vueSetupExtend()] + const plugins: PluginOption[] = [...vue, UnoCSS(), ...unplugin, mock, vueSetupExtend()] // 是否压缩 if (env.VITE_COMPRESS_OPEN === 'Y') plugins.push(compress(env)) diff --git a/build/plugins/unplugin.ts b/build/plugins/unplugin.ts index 3b56729..9f10f5a 100644 --- a/build/plugins/unplugin.ts +++ b/build/plugins/unplugin.ts @@ -10,7 +10,7 @@ import { createSvgIconsPlugin } from 'vite-plugin-svg-icons' // https://github.c export default [ AutoImport({ - imports: ['vue', 'vue-router','pinia'], + imports: ['vue', 'vue-router', 'pinia'], include: [ /\.[tj]sx?$/, /\.vue$/, diff --git a/build/plugins/vue.ts b/build/plugins/vue.ts index 5f9e324..b9f4d43 100644 --- a/build/plugins/vue.ts +++ b/build/plugins/vue.ts @@ -1,7 +1,10 @@ import vue from '@vitejs/plugin-vue' -import vueJsx from '@vitejs/plugin-vue-jsx' // https://github.com/vitejs/vite/tree/main/packages/plugin-vue-jsx + +import vueJsx from '@vitejs/plugin-vue-jsx' + +// https://github.com/vitejs/vite/tree/main/packages/plugin-vue-jsx import VueDevTools from 'vite-plugin-vue-devtools' // https://github.com/webfansplz/vite-plugin-vue-devtools -const plugins = [vue(), vueJsx(),VueDevTools()] +const plugins = [vue(), vueJsx(), VueDevTools()] export default plugins diff --git a/package.json b/package.json index a8b5cd7..eae451a 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,7 @@ "dev:prod": "vite --mode production", "build": "vue-tsc --noEmit && vite build", "preview": "vite preview", - "lint": "eslint . --fix", + "lint": "eslint --fix", "prepare": "husky install", "commit": "cz", "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0 && git add CHANGELOG.md" @@ -78,12 +78,12 @@ "@types/mockjs": "^1.0.7", "@types/node": "^20.3.1", "@types/qs": "^6.9.7", - "@vitejs/plugin-vue": "^4.0.0", + "@vitejs/plugin-vue": "^4.2.3", "@vitejs/plugin-vue-jsx": "^3.0.0", "commitizen": "^4.2.6", "cz-conventional-changelog": "^3.3.0", "cz-customizable": "^7.0.0", - "eslint": "^8.36.0", + "eslint": "^8.42.0", "husky": "^8.0.3", "less": "^4.1.3", "lint-staged": "^13.1.0", diff --git a/src/App.vue b/src/App.vue index 91e5f0e..812602a 100644 --- a/src/App.vue +++ b/src/App.vue @@ -2,7 +2,7 @@ import type { GlobalThemeOverrides } from 'naive-ui' import { dateZhCN, useOsTheme, zhCN } from 'naive-ui' import { useAppStore } from './store' -import themeConfig from './theme.json'; +import themeConfig from './theme.json' const locale = zhCN const dateLocale = dateZhCN @@ -14,8 +14,10 @@ const themeOverrides: GlobalThemeOverrides = {} || themeConfig diff --git a/src/components/common/DarkModeSwitch.vue b/src/components/common/DarkModeSwitch.vue index b494876..5845f64 100644 --- a/src/components/common/DarkModeSwitch.vue +++ b/src/components/common/DarkModeSwitch.vue @@ -1,5 +1,6 @@ diff --git a/src/components/common/appLoading.vue b/src/components/common/appLoading.vue index 155ab2f..e71f3d9 100644 --- a/src/components/common/appLoading.vue +++ b/src/components/common/appLoading.vue @@ -1,5 +1,6 @@ diff --git a/src/components/custom/QRCode.vue b/src/components/custom/QRCode.vue index ebf30ce..c400a0e 100644 --- a/src/components/custom/QRCode.vue +++ b/src/components/custom/QRCode.vue @@ -1,5 +1,7 @@ diff --git a/src/layouts/components/header/Github.vue b/src/layouts/components/header/Github.vue index 4c1daf9..7f2844f 100644 --- a/src/layouts/components/header/Github.vue +++ b/src/layouts/components/header/Github.vue @@ -1,6 +1,7 @@ diff --git a/src/layouts/components/header/Reload.vue b/src/layouts/components/header/Reload.vue index 8258e31..0f25464 100644 --- a/src/layouts/components/header/Reload.vue +++ b/src/layouts/components/header/Reload.vue @@ -1,11 +1,12 @@ diff --git a/src/layouts/components/header/Setting.vue b/src/layouts/components/header/Setting.vue index e32f084..afd9ef7 100644 --- a/src/layouts/components/header/Setting.vue +++ b/src/layouts/components/header/Setting.vue @@ -1,10 +1,11 @@ diff --git a/src/layouts/components/header/UserCenter.vue b/src/layouts/components/header/UserCenter.vue index d777883..7b0b51d 100644 --- a/src/layouts/components/header/UserCenter.vue +++ b/src/layouts/components/header/UserCenter.vue @@ -22,7 +22,7 @@ const options = [ icon: renderIcon('icon-park-outline:logout'), }, ] -const handleSelect = (key: string | number) => { +function handleSelect(key: string | number) { if (key === 'loginOut') { window.$dialog.info({ title: '退出登录', diff --git a/src/layouts/components/sider/Logo.vue b/src/layouts/components/sider/Logo.vue index e0516f9..199b875 100644 --- a/src/layouts/components/sider/Logo.vue +++ b/src/layouts/components/sider/Logo.vue @@ -1,6 +1,7 @@ diff --git a/src/views/test/test1/index.vue b/src/views/test/test1/index.vue index f68f634..1d0a28e 100644 --- a/src/views/test/test1/index.vue +++ b/src/views/test/test1/index.vue @@ -13,20 +13,20 @@ import { } from '@/service' const msg = ref() -const pinter = () => { +function pinter() { msg.value = import.meta.env } -const get = () => { +function get() { fetachGet({ a: 112211 }).then((res) => { msg.value = res }) } -const delete2 = () => { +function delete2() { fetachDelete().then((res) => { msg.value = res }) } -const post = () => { +function post() { const params = { data: '2022-2-2', data1: [], @@ -48,7 +48,7 @@ function formPost() { msg.value = res }) } -const put = () => { +function put() { const params = { data: '2022-2-2', } @@ -58,30 +58,30 @@ const put = () => { } // 测试请求失败 -const failedRequest = () => { +function failedRequest() { testFailedRequest().then((res) => { msg.value = res }) } // 测试业务失败 -const failedResponse = () => { +function failedResponse() { testFailedResponse().then((res) => { msg.value = res }) } // 测试业务失败无提示 -const failedResponse_NT = () => { +function failedResponse_NT() { testFailedResponse_NT().then((res) => { msg.value = res }) } // 测试刷新token -const updataToken = () => { +function updataToken() { testUpdataToken().then((res) => { msg.value = res }) } -const mock = () => { +function mock() { fetchMock().then((res) => { msg.value = res }) diff --git a/src/views/test/test2/index.vue b/src/views/test/test2/index.vue index fcb9e3e..96668ab 100644 --- a/src/views/test/test2/index.vue +++ b/src/views/test/test2/index.vue @@ -1,5 +1,6 @@ diff --git a/src/views/test/test3/test4/index.vue b/src/views/test/test3/test4/index.vue index d610d2a..58196f6 100644 --- a/src/views/test/test3/test4/index.vue +++ b/src/views/test/test3/test4/index.vue @@ -1,5 +1,5 @@ diff --git a/unocss.config.ts b/unocss.config.ts index f02ff16..781af8e 100644 --- a/unocss.config.ts +++ b/unocss.config.ts @@ -1,4 +1,4 @@ -import { presetUno,presetAttributify,defineConfig } from 'unocss' // https://github.com/unocss/unocss +import { defineConfig, presetAttributify, presetUno } from 'unocss' // https://github.com/unocss/unocss export default defineConfig({ presets: [presetUno({ dark: 'class' }), presetAttributify()],