From 7f02e18d374effdb0d0db3eea6011a7fd4490a0f Mon Sep 17 00:00:00 2001 From: pany <939630029@qq.com> Date: Mon, 18 Nov 2024 19:40:44 +0800 Subject: [PATCH] chore: pnpm eslint . --fix --- eslint.config.js | 42 ++++++++- package.json | 1 + pnpm-lock.yaml | 68 +++++++++++++- public/detect-ie.js | 3 +- src/App.vue | 2 +- src/api/login/index.ts | 2 +- src/api/login/types/login.ts | 2 +- src/api/table/index.ts | 2 +- src/components/Notify/NotifyList.vue | 10 ++- src/components/Notify/index.vue | 15 ++-- src/components/Screenfull/index.vue | 26 +++--- src/components/SearchMenu/SearchModal.vue | 56 ++++++------ src/components/SearchMenu/SearchResult.vue | 15 ++-- src/components/SearchMenu/index.vue | 2 +- src/components/ThemeSwitch/index.vue | 11 +-- src/config/layouts.ts | 2 +- src/config/route.ts | 3 +- src/config/white-list.ts | 6 +- src/directives/index.ts | 2 +- src/directives/permission/index.ts | 4 +- src/hooks/useDevice.ts | 4 +- src/hooks/useFetchSelect.ts | 2 +- src/hooks/useFullscreenLoading.ts | 5 +- src/hooks/useGreyAndColorWeakness.ts | 4 +- src/hooks/useLayoutMode.ts | 6 +- src/hooks/useRouteListener.ts | 6 +- src/hooks/useTheme.ts | 12 +-- src/hooks/useTitle.ts | 2 +- src/hooks/useWatermark.ts | 10 ++- src/icons/index.ts | 2 +- src/layouts/LeftMode.vue | 8 +- src/layouts/LeftTopMode.vue | 6 +- src/layouts/TopMode.vue | 4 +- src/layouts/components/AppMain.vue | 2 +- src/layouts/components/Breadcrumb/index.vue | 13 +-- src/layouts/components/Footer/index.vue | 4 +- src/layouts/components/Hamburger/index.vue | 2 +- src/layouts/components/Logo/index.vue | 8 +- .../components/NavigationBar/index.vue | 22 ++--- src/layouts/components/RightPanel/index.vue | 4 +- .../components/Settings/SelectLayoutMode.vue | 2 +- src/layouts/components/Settings/index.vue | 34 +++---- .../components/Sidebar/SidebarItem.vue | 14 +-- src/layouts/components/Sidebar/index.vue | 23 +++-- .../components/TagsView/ScrollPane.vue | 31 +++---- src/layouts/components/TagsView/index.vue | 68 ++++++++------ src/layouts/components/index.ts | 4 +- src/layouts/hooks/useResize.ts | 6 +- src/layouts/index.vue | 22 ++--- src/main.ts | 6 +- src/plugins/element-plus-icon/index.ts | 2 +- src/plugins/element-plus/index.ts | 2 +- src/plugins/index.ts | 2 +- src/plugins/vxe-table/index.ts | 2 +- src/router/helper.ts | 28 +++--- src/router/index.ts | 7 +- src/router/permission.ts | 19 ++-- src/store/modules/app.ts | 8 +- src/store/modules/permission.ts | 16 ++-- src/store/modules/settings.ts | 12 +-- src/store/modules/tags-view.ts | 37 ++++---- src/store/modules/user.ts | 20 ++--- src/utils/cache/cookies.ts | 6 +- src/utils/cache/local-storage.ts | 46 +++++----- src/utils/css.ts | 4 +- src/utils/datetime.ts | 2 +- src/utils/permission.ts | 4 +- src/utils/service.ts | 11 +-- src/utils/validate.ts | 48 +++++----- src/views/error-page/403.vue | 2 +- src/views/error-page/404.vue | 2 +- .../error-page/components/ErrorPageLayout.vue | 4 +- src/views/hook-demo/use-fetch-select.vue | 6 +- .../hook-demo/use-fullscreen-loading.vue | 17 ++-- src/views/hook-demo/use-watermark.vue | 18 ++-- src/views/login/index.vue | 24 ++--- src/views/menu/menu1/menu1-1/index.vue | 2 +- .../menu/menu1/menu1-2/menu1-2-1/index.vue | 2 +- .../menu/menu1/menu1-2/menu1-2-2/index.vue | 2 +- src/views/menu/menu1/menu1-3/index.vue | 2 +- .../permission/components/SwitchRoles.vue | 2 +- src/views/permission/page.vue | 4 +- src/views/redirect/index.vue | 2 +- src/views/table/element-plus/index.vue | 90 ++++++++++++------- src/views/table/vxe-table/index.vue | 48 +++++----- .../table/vxe-table/tsx/RoleColumnSolts.tsx | 2 +- .../table/vxe-table/tsx/StatusColumnSolts.tsx | 2 +- src/views/unocss/index.vue | 12 ++- tests/components/Notify.test.ts | 12 +-- tests/utils/validate.test.ts | 20 ++--- tsconfig.json | 42 ++++----- types/global-components.d.ts | 2 +- vite.config.ts | 7 +- 93 files changed, 704 insertions(+), 508 deletions(-) diff --git a/eslint.config.js b/eslint.config.js index 3b614a0d..114fe535 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -1,3 +1,41 @@ -import antfu from '@antfu/eslint-config' +import antfu from "@antfu/eslint-config" -export default antfu() +// 更多自定义配置可查阅仓库:https://github.com/antfu/eslint-config +export default antfu( + { + // 使用外部格式化程序格式化 css、html、markdown 等文件 + formatters: true, + // 启用样式规则 + stylistic: { + // 缩进级别 + indent: 2, + // 引号风格 'single' | 'double' + quotes: "double", + // 是否启用分号 + semi: false + }, + // 忽略文件 + ignores: [] + }, + { + // 对所有文件都生效的规则 + rules: { + // vue + "vue/block-order": ["error", { order: ["script", "template", "style"] }], + // ts + "ts/no-use-before-define": "off", + // node + "node/prefer-global/process": "off", + // style + "style/comma-dangle": ["error", "never"], + "style/brace-style": "off", + // regexp + "regexp/no-unused-capturing-group": "off", + // other + "no-console": "off", + "no-debugger": "off", + "symbol-description": "off", + "antfu/if-newline": "off" + } + } +) diff --git a/package.json b/package.json index 7579c4ac..e8b2e5ce 100644 --- a/package.json +++ b/package.json @@ -67,6 +67,7 @@ "@vitejs/plugin-vue-jsx": "4.1.0", "@vue/test-utils": "2.4.6", "eslint": "9.15.0", + "eslint-plugin-format": "0.1.2", "husky": "9.1.6", "jsdom": "25.0.1", "lint-staged": "15.2.10", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 1aa4a5c1..26abe2f8 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -65,7 +65,7 @@ importers: devDependencies: '@antfu/eslint-config': specifier: 3.9.1 - version: 3.9.1(@typescript-eslint/utils@8.14.0(eslint@9.15.0(jiti@1.21.6))(typescript@5.6.3))(@vue/compiler-sfc@3.5.13)(eslint@9.15.0(jiti@1.21.6))(typescript@5.6.3)(vitest@2.1.5(@types/node@22.9.0)(jsdom@25.0.1)(sass@1.78.0)) + version: 3.9.1(@typescript-eslint/utils@8.14.0(eslint@9.15.0(jiti@1.21.6))(typescript@5.6.3))(@vue/compiler-sfc@3.5.13)(eslint-plugin-format@0.1.2(eslint@9.15.0(jiti@1.21.6)))(eslint@9.15.0(jiti@1.21.6))(typescript@5.6.3)(vitest@2.1.5(@types/node@22.9.0)(jsdom@25.0.1)(sass@1.78.0)) '@types/js-cookie': specifier: 3.0.6 version: 3.0.6 @@ -93,6 +93,9 @@ importers: eslint: specifier: 9.15.0 version: 9.15.0(jiti@1.21.6) + eslint-plugin-format: + specifier: 0.1.2 + version: 0.1.2(eslint@9.15.0(jiti@1.21.6)) husky: specifier: 9.1.6 version: 9.1.6 @@ -313,6 +316,15 @@ packages: resolution: {integrity: sha512-SITSV6aIXsuVNV3f3O0f2n/cgyEDWoSqtZMYiAmcsYHydcKrOz3gUxB/iXd/Qf08+IZX4KpgNbvUdMBmWz+kcA==} engines: {node: '>=10'} + '@dprint/formatter@0.3.0': + resolution: {integrity: sha512-N9fxCxbaBOrDkteSOzaCqwWjso5iAe+WJPsHC021JfHNj2ThInPNEF13ORDKta3llq5D1TlclODCvOvipH7bWQ==} + + '@dprint/markdown@0.17.8': + resolution: {integrity: sha512-ukHFOg+RpG284aPdIg7iPrCYmMs3Dqy43S1ejybnwlJoFiW02b+6Bbr5cfZKFRYNP3dKGM86BqHEnMzBOyLvvA==} + + '@dprint/toml@0.6.3': + resolution: {integrity: sha512-zQ42I53sb4WVHA+5yoY1t59Zk++Ot02AvUgtNKLzTT8mPyVqVChFcePa3on/xIoKEgH+RoepgPHzqfk9837YFw==} + '@element-plus/icons-vue@2.3.1': resolution: {integrity: sha512-XxVUZv48RZAd87ucGS48jPf6pKu0yV5UCg9f4FFwtrYxXOwWuVJo6wOvSLKEoMQKjv8GsX/mhP6UsC1lRwbUWg==} peerDependencies: @@ -1808,6 +1820,11 @@ packages: eslint-flat-config-utils@0.4.0: resolution: {integrity: sha512-kfd5kQZC+BMO0YwTol6zxjKX1zAsk8JfSAopbKjKqmENTJcew+yBejuvccAg37cvOrN0Mh+DVbeyznuNWEjt4A==} + eslint-formatting-reporter@0.0.0: + resolution: {integrity: sha512-k9RdyTqxqN/wNYVaTk/ds5B5rA8lgoAmvceYN7bcZMBwU7TuXx5ntewJv81eF3pIL/CiJE+pJZm36llG8yhyyw==} + peerDependencies: + eslint: '>=8.40.0' + eslint-import-resolver-node@0.3.9: resolution: {integrity: sha512-WFj2isz22JahUv+B788TlO3N6zL3nNJGU8CcZbPZvVEkBPaJdCV4vy5wyghty5ROFbCRnm132v8BScu5/1BQ8g==} @@ -1827,6 +1844,9 @@ packages: peerDependencies: eslint: '*' + eslint-parser-plain@0.1.0: + resolution: {integrity: sha512-oOeA6FWU0UJT/Rxc3XF5Cq0nbIZbylm7j8+plqq0CZoE6m4u32OXJrR+9iy4srGMmF6v6pmgvP1zPxSRIGh3sg==} + eslint-plugin-antfu@2.7.0: resolution: {integrity: sha512-gZM3jq3ouqaoHmUNszb1Zo2Ux7RckSvkGksjLWz9ipBYGSv1EwwBETN6AdiUXn+RpVHXTbEMPAPlXJazcA6+iA==} peerDependencies: @@ -1843,6 +1863,11 @@ packages: peerDependencies: eslint: '>=8' + eslint-plugin-format@0.1.2: + resolution: {integrity: sha512-ZrcO3aiumgJ6ENAv65IWkPjtW77ML/5mp0YrRK0jdvvaZJb+4kKWbaQTMr/XbJo6CtELRmCApAziEKh7L2NbdQ==} + peerDependencies: + eslint: ^8.40.0 || ^9.0.0 + eslint-plugin-import-x@4.4.2: resolution: {integrity: sha512-mDRXPSLQ0UQZQw91QdG4/qZT6hgeW2MJTczAbgPseUZuPEtIjjdPOolXroRkulnOn3fzj6gNgvk+wchMJiHElg==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} @@ -2025,6 +2050,9 @@ packages: fast-deep-equal@3.1.3: resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==} + fast-diff@1.3.0: + resolution: {integrity: sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw==} + fast-glob@3.3.2: resolution: {integrity: sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow==} engines: {node: '>=8.6.0'} @@ -3150,6 +3178,10 @@ packages: resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==} engines: {node: '>= 0.8.0'} + prettier-linter-helpers@1.0.0: + resolution: {integrity: sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==} + engines: {node: '>=6.0.0'} + prettier@3.3.3: resolution: {integrity: sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew==} engines: {node: '>=14'} @@ -3974,7 +4006,7 @@ snapshots: '@jridgewell/gen-mapping': 0.3.5 '@jridgewell/trace-mapping': 0.3.25 - '@antfu/eslint-config@3.9.1(@typescript-eslint/utils@8.14.0(eslint@9.15.0(jiti@1.21.6))(typescript@5.6.3))(@vue/compiler-sfc@3.5.13)(eslint@9.15.0(jiti@1.21.6))(typescript@5.6.3)(vitest@2.1.5(@types/node@22.9.0)(jsdom@25.0.1)(sass@1.78.0))': + '@antfu/eslint-config@3.9.1(@typescript-eslint/utils@8.14.0(eslint@9.15.0(jiti@1.21.6))(typescript@5.6.3))(@vue/compiler-sfc@3.5.13)(eslint-plugin-format@0.1.2(eslint@9.15.0(jiti@1.21.6)))(eslint@9.15.0(jiti@1.21.6))(typescript@5.6.3)(vitest@2.1.5(@types/node@22.9.0)(jsdom@25.0.1)(sass@1.78.0))': dependencies: '@antfu/install-pkg': 0.4.1 '@clack/prompts': 0.7.0 @@ -4012,6 +4044,8 @@ snapshots: vue-eslint-parser: 9.4.3(eslint@9.15.0(jiti@1.21.6)) yaml-eslint-parser: 1.2.3 yargs: 17.7.2 + optionalDependencies: + eslint-plugin-format: 0.1.2(eslint@9.15.0(jiti@1.21.6)) transitivePeerDependencies: - '@eslint/json' - '@typescript-eslint/utils' @@ -4206,6 +4240,12 @@ snapshots: '@ctrl/tinycolor@3.6.1': {} + '@dprint/formatter@0.3.0': {} + + '@dprint/markdown@0.17.8': {} + + '@dprint/toml@0.6.3': {} + '@element-plus/icons-vue@2.3.1(vue@3.5.13(typescript@5.6.3))': dependencies: vue: 3.5.13(typescript@5.6.3) @@ -5784,6 +5824,11 @@ snapshots: dependencies: pathe: 1.1.2 + eslint-formatting-reporter@0.0.0(eslint@9.15.0(jiti@1.21.6)): + dependencies: + eslint: 9.15.0(jiti@1.21.6) + prettier-linter-helpers: 1.0.0 + eslint-import-resolver-node@0.3.9: dependencies: debug: 3.2.7 @@ -5802,6 +5847,8 @@ snapshots: dependencies: eslint: 9.15.0(jiti@1.21.6) + eslint-parser-plain@0.1.0: {} + eslint-plugin-antfu@2.7.0(eslint@9.15.0(jiti@1.21.6)): dependencies: '@antfu/utils': 0.7.10 @@ -5819,6 +5866,17 @@ snapshots: eslint: 9.15.0(jiti@1.21.6) eslint-compat-utils: 0.5.1(eslint@9.15.0(jiti@1.21.6)) + eslint-plugin-format@0.1.2(eslint@9.15.0(jiti@1.21.6)): + dependencies: + '@dprint/formatter': 0.3.0 + '@dprint/markdown': 0.17.8 + '@dprint/toml': 0.6.3 + eslint: 9.15.0(jiti@1.21.6) + eslint-formatting-reporter: 0.0.0(eslint@9.15.0(jiti@1.21.6)) + eslint-parser-plain: 0.1.0 + prettier: 3.3.3 + synckit: 0.9.2 + eslint-plugin-import-x@4.4.2(eslint@9.15.0(jiti@1.21.6))(typescript@5.6.3): dependencies: '@typescript-eslint/utils': 8.14.0(eslint@9.15.0(jiti@1.21.6))(typescript@5.6.3) @@ -6110,6 +6168,8 @@ snapshots: fast-deep-equal@3.1.3: {} + fast-diff@1.3.0: {} + fast-glob@3.3.2: dependencies: '@nodelib/fs.stat': 2.0.5 @@ -7379,6 +7439,10 @@ snapshots: prelude-ls@1.2.1: {} + prettier-linter-helpers@1.0.0: + dependencies: + fast-diff: 1.3.0 + prettier@3.3.3: {} proto-list@1.2.4: {} diff --git a/public/detect-ie.js b/public/detect-ie.js index 3568e83e..e98ea0a4 100644 --- a/public/detect-ie.js +++ b/public/detect-ie.js @@ -1,5 +1,4 @@ // Tip: Simple judgments may not fully cover if (/MSIE\s|Trident\//.test(window.navigator.userAgent)) { - document.body.innerHTML = - "Sorry, this browser is currently not supported. We recommend using the latest version of a modern browser. For example, Chrome/Firefox/Edge." + document.body.innerHTML = "Sorry, this browser is currently not supported. We recommend using the latest version of a modern browser. For example, Chrome/Firefox/Edge." } diff --git a/src/App.vue b/src/App.vue index 54b68cc6..3cbc3119 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,6 +1,6 @@ @@ -64,7 +65,7 @@ const handleHistory = () => {