From 56a966cfbf8db5b29a42185f0f25a0e800c30dbb Mon Sep 17 00:00:00 2001 From: vben Date: Tue, 24 Aug 2021 22:41:48 +0800 Subject: [PATCH] chore: format code --- .vscode/launch.json | 2 +- README.zh-CN.md | 2 +- build/generate/icon/index.ts | 6 +++--- build/script/buildConf.ts | 2 +- build/vite/plugin/compress.ts | 6 +++--- build/vite/plugin/index.ts | 2 +- mock/_util.ts | 2 +- mock/sys/user.ts | 2 +- prettier.config.js | 3 +-- src/App.vue | 1 + src/api/sys/upload.ts | 4 ++-- src/api/sys/user.ts | 2 +- .../Application/src/AppDarkModeToggle.vue | 2 +- .../Application/src/search/AppSearchModal.vue | 2 +- src/components/Basic/src/BasicHelp.vue | 2 +- src/components/Button/src/PopConfirmButton.vue | 2 +- .../CodeEditor/src/codemirror/CodeMirror.vue | 8 ++++---- src/components/Cropper/src/CropperAvatar.vue | 4 ++-- src/components/Description/src/typing.ts | 2 +- src/components/Drawer/src/BasicDrawer.vue | 4 ++-- src/components/FlowChart/src/FlowChart.vue | 4 ++-- src/components/Form/src/BasicForm.vue | 10 +++++----- src/components/Form/src/components/ApiSelect.vue | 2 +- .../Form/src/components/ApiTreeSelect.vue | 4 ++-- src/components/Form/src/components/FormAction.vue | 4 ++-- src/components/Form/src/components/FormItem.vue | 2 +- src/components/Form/src/helper.ts | 2 +- src/components/Form/src/hooks/useAdvanced.ts | 4 ++-- src/components/Form/src/hooks/useForm.ts | 6 +++--- src/components/Form/src/hooks/useFormEvents.ts | 8 ++++---- src/components/Form/src/types/form.ts | 2 +- src/components/Icon/src/IconPicker.vue | 6 +++--- src/components/Loading/src/useLoading.ts | 2 +- src/components/Markdown/src/Markdown.vue | 4 ++-- src/components/Menu/src/BasicMenu.vue | 4 ++-- src/components/Menu/src/useOpenKeys.ts | 4 ++-- src/components/Modal/src/BasicModal.vue | 2 +- .../Modal/src/components/ModalWrapper.vue | 4 ++-- src/components/Page/src/PageWrapper.vue | 6 +++--- src/components/Qrcode/src/Qrcode.vue | 2 +- src/components/Qrcode/src/drawCanvas.ts | 4 ++-- src/components/Scrollbar/src/bar.ts | 4 ++-- src/components/SimpleMenu/src/SimpleMenu.vue | 6 +++--- src/components/SimpleMenu/src/components/Menu.vue | 2 +- .../SimpleMenu/src/components/MenuItem.vue | 2 +- .../SimpleMenu/src/components/SubMenuItem.vue | 2 +- src/components/SimpleMenu/src/useOpenKeys.ts | 4 ++-- src/components/StrengthMeter/src/StrengthMeter.vue | 2 +- src/components/Table/src/BasicTable.vue | 8 ++++---- .../Table/src/components/editable/CellComponent.ts | 4 ++-- .../Table/src/components/editable/EditableCell.vue | 6 +++--- .../src/components/settings/ColumnSetting.vue | 2 +- src/components/Table/src/hooks/useColumns.ts | 10 +++++----- src/components/Table/src/hooks/useCustomRow.ts | 4 ++-- src/components/Table/src/hooks/useDataSource.ts | 10 +++++----- src/components/Table/src/hooks/useLoading.ts | 2 +- src/components/Table/src/hooks/useRowSelection.ts | 8 ++++---- src/components/Table/src/hooks/useTable.ts | 6 +++--- src/components/Table/src/hooks/useTableExpand.ts | 2 +- src/components/Table/src/hooks/useTableFooter.ts | 4 ++-- src/components/Table/src/hooks/useTableForm.ts | 2 +- src/components/Table/src/hooks/useTableHeader.ts | 4 ++-- src/components/Table/src/hooks/useTableScroll.ts | 4 ++-- src/components/Time/src/Time.vue | 2 +- src/components/Tinymce/src/Editor.vue | 6 +++--- src/components/Transition/index.ts | 4 ++-- src/components/Transition/src/CreateTransition.tsx | 2 +- src/components/Tree/src/Tree.vue | 8 ++++---- src/components/Tree/src/TreeHeader.vue | 4 ++-- src/components/Tree/src/useTree.ts | 2 +- src/components/Upload/src/BasicUpload.vue | 2 +- src/components/Upload/src/FileList.vue | 2 +- src/components/Upload/src/UploadModal.vue | 8 ++++---- src/components/Upload/src/UploadPreviewModal.vue | 4 ++-- src/components/Verify/src/DragVerify.vue | 2 +- src/components/Verify/src/ImgRotate.vue | 4 ++-- src/directives/loading.ts | 2 +- src/hooks/component/useFormItem.ts | 2 +- src/hooks/core/useContext.ts | 4 ++-- src/hooks/core/useLockFn.ts | 2 +- src/hooks/core/useTimeout.ts | 2 +- src/hooks/event/useEventListener.ts | 2 +- src/hooks/event/useScroll.ts | 4 ++-- src/hooks/setting/index.ts | 2 +- src/hooks/setting/useMenuSetting.ts | 2 +- src/hooks/setting/useRootSetting.ts | 2 +- src/hooks/web/useContentHeight.ts | 6 +++--- src/hooks/web/useCopyToClipboard.ts | 2 +- src/hooks/web/useECharts.ts | 4 ++-- src/hooks/web/usePermission.ts | 2 +- src/hooks/web/useTitle.ts | 6 +++++- src/hooks/web/useWatermark.ts | 4 ++-- .../default/content/useContentViewHeight.ts | 2 +- .../header/components/notify/NoticeList.vue | 2 +- src/layouts/default/menu/index.vue | 2 +- src/layouts/default/menu/useLayoutMenu.ts | 10 +++++----- .../default/setting/components/SettingFooter.vue | 2 +- src/layouts/default/tabs/components/FoldButton.vue | 2 +- src/layouts/default/tabs/components/TabContent.vue | 4 ++-- src/logics/error-handle/index.ts | 6 +++--- src/logics/mitt/routeChange.ts | 2 +- src/main.ts | 3 +-- src/router/helper/routeHelper.ts | 6 +++--- src/store/modules/user.ts | 2 +- src/utils/cache/memory.ts | 2 +- src/utils/color.ts | 4 ++-- src/utils/dateUtil.ts | 2 +- src/utils/domUtils.ts | 4 ++-- src/utils/env.ts | 2 +- src/utils/helper/treeHelper.ts | 14 +++++++------- src/utils/http/axios/axiosTransform.ts | 2 +- src/utils/http/axios/checkStatus.ts | 2 +- src/utils/http/axios/helper.ts | 2 +- src/utils/http/axios/index.ts | 6 +++--- src/utils/index.ts | 2 +- .../analysis/components/SalesProductPie.vue | 2 +- .../dashboard/analysis/components/VisitRadar.vue | 2 +- .../dashboard/analysis/components/VisitSource.vue | 2 +- .../dashboard/workbench/components/ProjectCard.vue | 2 +- .../dashboard/workbench/components/SaleRadar.vue | 2 +- src/views/demo/charts/SaleRadar.vue | 2 +- src/views/demo/comp/drawer/Drawer3.vue | 2 +- src/views/demo/comp/drawer/Drawer5.vue | 2 +- src/views/demo/comp/modal/Modal1.vue | 4 ++-- src/views/demo/comp/modal/Modal3.vue | 2 +- src/views/demo/comp/qrcode/index.vue | 4 ++-- .../demo/feat/breadcrumb/ChildrenListDetail.vue | 2 +- src/views/demo/feat/breadcrumb/FlatListDetail.vue | 2 +- src/views/demo/feat/download/index.vue | 2 +- src/views/demo/feat/ripple/index.vue | 2 +- src/views/demo/form/AppendForm.vue | 6 +++--- src/views/demo/form/DynamicForm.vue | 2 +- src/views/demo/main-out/index.vue | 2 +- .../demo/page/account/setting/AccountBind.vue | 2 +- .../demo/page/account/setting/BaseSetting.vue | 2 +- src/views/demo/page/account/setting/MsgNotify.vue | 2 +- .../demo/page/account/setting/SecureSetting.vue | 2 +- src/views/demo/page/desc/high/index.vue | 5 ++++- src/views/demo/page/result/fail/index.vue | 2 +- src/views/demo/page/result/success/index.vue | 5 ++++- src/views/demo/permission/back/Btn.vue | 2 +- src/views/demo/permission/back/index.vue | 2 +- src/views/demo/permission/front/AuthPageA.vue | 2 +- src/views/demo/permission/front/AuthPageB.vue | 2 +- src/views/sys/error-log/index.vue | 2 +- src/views/sys/lock/LockPage.vue | 2 +- src/views/sys/login/LoginForm.vue | 2 +- tests/server/index.ts | 4 ++-- 148 files changed, 259 insertions(+), 250 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 384f3bec..72e95d0d 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -8,6 +8,6 @@ "url": "http://localhost:3100", "webRoot": "${workspaceFolder}/src", "sourceMaps": true - }, + } ] } diff --git a/README.zh-CN.md b/README.zh-CN.md index 930fba59..acb575f5 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -150,7 +150,7 @@ yarn build ## 后台整合示例 - [lamp-cloud](https://github.com/zuihou/lamp-cloud) - 基于 SpringCloud Alibaba 的微服务中后台快速开发平台 -- [matecloud](https://github.com/matevip/matecloud) - MateCloud微服务脚手架,基于Spring Cloud 2020.0.3、SpringBoot 2.5.3的全开源平台 +- [matecloud](https://github.com/matevip/matecloud) - MateCloud 微服务脚手架,基于 Spring Cloud 2020.0.3、SpringBoot 2.5.3 的全开源平台 ## 维护者 diff --git a/build/generate/icon/index.ts b/build/generate/icon/index.ts index a9bac80f..c78cb09f 100644 --- a/build/generate/icon/index.ts +++ b/build/generate/icon/index.ts @@ -52,19 +52,19 @@ async function generateIcon() { const { prefix } = data; const isLocal = useType === 'local'; const icons = Object.keys(data.icons).map( - (item) => `${isLocal ? prefix + ':' : ''}${item}` + (item) => `${isLocal ? prefix + ':' : ''}${item}`, ); await fs.writeFileSync( path.join(output, `icons.data.ts`), - `export default ${isLocal ? JSON.stringify(icons) : JSON.stringify({ prefix, icons })}` + `export default ${isLocal ? JSON.stringify(icons) : JSON.stringify({ prefix, icons })}`, ); prefixSet.push(prefix); } } fs.emptyDir(path.join(process.cwd(), 'node_modules/.vite')); console.log( - `✨ ${chalk.cyan(`[${pkg.name}]`)}` + ' - Icon generated successfully:' + `[${prefixSet}]` + `✨ ${chalk.cyan(`[${pkg.name}]`)}` + ' - Icon generated successfully:' + `[${prefixSet}]`, ); }); } diff --git a/build/script/buildConf.ts b/build/script/buildConf.ts index a44a1d8e..48ed4d9b 100644 --- a/build/script/buildConf.ts +++ b/build/script/buildConf.ts @@ -15,7 +15,7 @@ function createConfig( configName, config, configFileName = GLOB_CONFIG_FILE_NAME, - }: { configName: string; config: any; configFileName?: string } = { configName: '', config: {} } + }: { configName: string; config: any; configFileName?: string } = { configName: '', config: {} }, ) { try { const windowConf = `window.${configName}`; diff --git a/build/vite/plugin/compress.ts b/build/vite/plugin/compress.ts index 34787ca1..3ad32be1 100644 --- a/build/vite/plugin/compress.ts +++ b/build/vite/plugin/compress.ts @@ -7,7 +7,7 @@ import compressPlugin from 'vite-plugin-compression'; export function configCompressPlugin( compress: 'gzip' | 'brotli' | 'none', - deleteOriginFile = false + deleteOriginFile = false, ): Plugin | Plugin[] { const compressList = compress.split(','); @@ -18,7 +18,7 @@ export function configCompressPlugin( compressPlugin({ ext: '.gz', deleteOriginFile, - }) + }), ); } @@ -28,7 +28,7 @@ export function configCompressPlugin( ext: '.br', algorithm: 'brotliCompress', deleteOriginFile, - }) + }), ); } return plugins; diff --git a/build/vite/plugin/index.ts b/build/vite/plugin/index.ts index 29ec002b..5f9f77a7 100644 --- a/build/vite/plugin/index.ts +++ b/build/vite/plugin/index.ts @@ -68,7 +68,7 @@ export function createVitePlugins(viteEnv: ViteEnv, isBuild: boolean) { // rollup-plugin-gzip vitePlugins.push( - configCompressPlugin(VITE_BUILD_COMPRESS, VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE) + configCompressPlugin(VITE_BUILD_COMPRESS, VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE), ); // vite-plugin-pwa diff --git a/mock/_util.ts b/mock/_util.ts index 0eedb758..97c87564 100644 --- a/mock/_util.ts +++ b/mock/_util.ts @@ -13,7 +13,7 @@ export function resultPageSuccess( page: number, pageSize: number, list: T[], - { message = 'ok' } = {} + { message = 'ok' } = {}, ) { const pageData = pagination(page, pageSize, list); diff --git a/mock/sys/user.ts b/mock/sys/user.ts index a8608f1b..8b8989fa 100644 --- a/mock/sys/user.ts +++ b/mock/sys/user.ts @@ -52,7 +52,7 @@ export default [ response: ({ body }) => { const { username, password } = body; const checkUser = createFakeUserList().find( - (item) => item.username === username && password === item.password + (item) => item.username === username && password === item.password, ); if (!checkUser) { return resultError('Incorrect account or password!'); diff --git a/prettier.config.js b/prettier.config.js index b4e993ae..343625f0 100644 --- a/prettier.config.js +++ b/prettier.config.js @@ -7,7 +7,7 @@ module.exports = { singleQuote: true, quoteProps: 'as-needed', bracketSpacing: true, - trailingComma: 'es5', + trailingComma: 'all', jsxBracketSameLine: false, jsxSingleQuote: false, arrowParens: 'always', @@ -16,5 +16,4 @@ module.exports = { proseWrap: 'never', htmlWhitespaceSensitivity: 'strict', endOfLine: 'auto', - rangeStart: 0, }; diff --git a/src/App.vue b/src/App.vue index 9084a8f4..f8df489e 100644 --- a/src/App.vue +++ b/src/App.vue @@ -15,5 +15,6 @@ // support Multi-language const { getAntdLocale } = useLocale(); + // Listening to page changes and dynamically changing site titles useTitle(); diff --git a/src/api/sys/upload.ts b/src/api/sys/upload.ts index 1f1b4389..c47baf43 100644 --- a/src/api/sys/upload.ts +++ b/src/api/sys/upload.ts @@ -10,13 +10,13 @@ const { uploadUrl = '' } = useGlobSetting(); */ export function uploadApi( params: UploadFileParams, - onUploadProgress: (progressEvent: ProgressEvent) => void + onUploadProgress: (progressEvent: ProgressEvent) => void, ) { return defHttp.uploadFile( { url: uploadUrl, onUploadProgress, }, - params + params, ); } diff --git a/src/api/sys/user.ts b/src/api/sys/user.ts index c0c88d31..da9f7a29 100644 --- a/src/api/sys/user.ts +++ b/src/api/sys/user.ts @@ -21,7 +21,7 @@ export function loginApi(params: LoginParams, mode: ErrorMessageMode = 'modal') }, { errorMessageMode: mode, - } + }, ); } diff --git a/src/components/Application/src/AppDarkModeToggle.vue b/src/components/Application/src/AppDarkModeToggle.vue index 6b07d92d..6df9c499 100644 --- a/src/components/Application/src/AppDarkModeToggle.vue +++ b/src/components/Application/src/AppDarkModeToggle.vue @@ -1,6 +1,6 @@