From 7b067decd5d3416de2a2be3b1207f0c3f32263f3 Mon Sep 17 00:00:00 2001 From: n0099 Date: Mon, 12 Feb 2024 02:57:01 +0800 Subject: [PATCH] * fix ghost dependencies used by `eslint-import-resolver-vite` https://github.com/pzmosquito/eslint-import-resolver-vite/pull/22 @ .yarnrc.yml $ yarn add -D vue-eslint-parser # ghost dependency used in .eslintrc.cjs * simplify glob in options of rule `import/order` @ .eslintrc.cjs $ yarn eslint --fix src @ fe --- fe/.eslintrc.cjs | 12 ++++++------ fe/.yarnrc.yml | 5 +++++ fe/package.json | 1 + fe/src/api/index.ts | 2 +- fe/src/components/Post/PostNav.vue | 2 +- fe/src/main.ts | 4 ++-- fe/src/views/Status.vue | 2 +- fe/yarn.lock | 29 +++++++++++++++-------------- 8 files changed, 32 insertions(+), 25 deletions(-) diff --git a/fe/.eslintrc.cjs b/fe/.eslintrc.cjs index 5fbec988..17de8f26 100644 --- a/fe/.eslintrc.cjs +++ b/fe/.eslintrc.cjs @@ -35,13 +35,13 @@ const eslintPluginImport = { // as of eslint-plugin-import@2.29.1 { pattern: '**/*.vue', group: 'internal', position: 'before' }, // vue SFC { pattern: '@/**', group: 'internal', position: 'before' }, { pattern: 'vue*', group: 'external', position: 'before' }, // vue vue-router - { pattern: '*vue', group: 'external', position: 'before' }, // ant-design-vue - { pattern: '*vue*/**', group: 'external', position: 'before' }, // @vueuse/core - { pattern: '*/*vue*/**', group: 'external', position: 'before' }, // @unhead/vue @fortawesome/vue-fontawesome - { pattern: '{lodash{,-{es,fp}},lodash{,-{es,fp}}/**}', group: 'external', position: 'after' }, // lodash - { pattern: '{echarts,echarts/**}', group: 'external', position: 'after' }, + { pattern: 'pinia', group: 'external', position: 'before' }, + { pattern: '*vue*{,/**}', group: 'external', position: 'before' }, // ant-design-vue @vueuse/core + { pattern: '*/*vue*{,/**}', group: 'external', position: 'before' }, // @unhead/vue @fortawesome/vue-fontawesome + { pattern: 'lodash{,-{es,fp}}{,/**}', group: 'external', position: 'after' }, // lodash + { pattern: 'echarts{,/**}', group: 'external', position: 'after' }, ], - pathGroupsExcludedImportTypes: [], + pathGroupsExcludedImportTypes: [], // https://github.com/import-js/eslint-plugin-import/issues/2897 distinctGroup: false, alphabetize: { order: 'asc', orderImportKind: 'asc' }, warnOnUnassignedImports: true, diff --git a/fe/.yarnrc.yml b/fe/.yarnrc.yml index 5883b72f..51a65dc2 100644 --- a/fe/.yarnrc.yml +++ b/fe/.yarnrc.yml @@ -1,2 +1,7 @@ nodeLinker: pnp yarnPath: .yarn/releases/yarn-4.1.0.cjs +packageExtensions: + "eslint-import-resolver-vite@*": + dependencies: # https://github.com/pzmosquito/eslint-import-resolver-vite/pull/22 + "resolve": "*" + "debug": "*" diff --git a/fe/package.json b/fe/package.json index 177fd56f..7b81a2d3 100644 --- a/fe/package.json +++ b/fe/package.json @@ -68,6 +68,7 @@ "typescript-eslint-parser-for-extra-files": "^0.6.0", "vite": "^5.1.1", "vite-bundle-analyzer": "^0.7.0", + "vue-eslint-parser": "^9.4.2", "vue-tsc": "^1.8.27" }, "browserslist": [ diff --git a/fe/src/api/index.ts b/fe/src/api/index.ts index 6372552d..37fc25c6 100644 --- a/fe/src/api/index.ts +++ b/fe/src/api/index.ts @@ -1,5 +1,5 @@ -import type { QueryFunctionContext } from '@tanstack/vue-query'; import type { ApiError, ApiForums, ApiPosts, ApiPostsParam, ApiStatsForumPostCount, ApiStatsForumPostCountQueryParam, ApiStatus, ApiStatusQueryParam, ApiUsers, ApiUsersParam } from '@/api/index.d'; +import type { QueryFunctionContext } from '@tanstack/vue-query'; import { useQuery } from '@tanstack/vue-query'; import nprogress from 'nprogress'; import { stringify } from 'qs'; diff --git a/fe/src/components/Post/PostNav.vue b/fe/src/components/Post/PostNav.vue index 13fb1b01..dc9bd676 100644 --- a/fe/src/components/Post/PostNav.vue +++ b/fe/src/components/Post/PostNav.vue @@ -51,8 +51,8 @@ import { useElementRefsStore } from '@/stores/elementRefs'; import { onUnmounted, ref, watchEffect } from 'vue'; import { useRoute, useRouter } from 'vue-router'; -import { Menu, MenuItem, SubMenu } from 'ant-design-vue'; import { useToggle } from '@vueuse/core'; +import { Menu, MenuItem, SubMenu } from 'ant-design-vue'; import type { MenuClickEventHandler } from 'ant-design-vue/lib/menu/src/interface'; import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'; import scrollIntoView from 'scroll-into-view-if-needed'; diff --git a/fe/src/main.ts b/fe/src/main.ts index a41d5472..e82641fb 100644 --- a/fe/src/main.ts +++ b/fe/src/main.ts @@ -2,8 +2,9 @@ import App from '@/App.vue'; import router from '@/router'; import * as fontAwesomeIcons from '@/shared/fontAwesome'; import '@/styles/style.css'; -import { createApp } from 'vue'; import { library } from '@fortawesome/fontawesome-svg-core'; +import { createApp } from 'vue'; +import { createPinia } from 'pinia'; import { VueQueryPlugin } from '@tanstack/vue-query'; import { createHead } from '@unhead/vue'; import 'bootstrap'; @@ -12,7 +13,6 @@ import 'noty/lib/noty.css'; import 'noty/lib/themes/mint.css'; import nprogress from 'nprogress'; import 'nprogress/nprogress.css'; -import { createPinia } from 'pinia'; library.add(...Object.values(fontAwesomeIcons)); diff --git a/fe/src/views/Status.vue b/fe/src/views/Status.vue index 1da63db7..f3982448 100644 --- a/fe/src/views/Status.vue +++ b/fe/src/views/Status.vue @@ -41,8 +41,8 @@ import { titleTemplate } from '@/shared'; import { commonToolboxFeatures, emptyChartSeriesData } from '@/shared/echarts'; import { onMounted, ref, watchEffect } from 'vue'; -import { Switch } from 'ant-design-vue'; import { useIntervalFn } from '@vueuse/core'; +import { Switch } from 'ant-design-vue'; import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'; import { useHead } from '@unhead/vue'; import * as _ from 'lodash-es'; diff --git a/fe/yarn.lock b/fe/yarn.lock index 6c1f5c4c..6fc238e8 100644 --- a/fe/yarn.lock +++ b/fe/yarn.lock @@ -2570,6 +2570,18 @@ __metadata: languageName: node linkType: hard +"debug@npm:*, debug@npm:^4.3.4": + version: 4.3.4 + resolution: "debug@npm:4.3.4" + dependencies: + ms: "npm:2.1.2" + peerDependenciesMeta: + supports-color: + optional: true + checksum: 10c0/cedbec45298dd5c501d01b92b119cd3faebe5438c3917ff11ae1bff86a6c722930ac9c8659792824013168ba6db7c4668225d845c633fbdafbbf902a6389f736 + languageName: node + linkType: hard + "debug@npm:4, debug@npm:^4.1.0, debug@npm:^4.1.1, debug@npm:^4.3.1, debug@npm:^4.3.2": version: 4.3.3 resolution: "debug@npm:4.3.3" @@ -2591,18 +2603,6 @@ __metadata: languageName: node linkType: hard -"debug@npm:^4.3.4": - version: 4.3.4 - resolution: "debug@npm:4.3.4" - dependencies: - ms: "npm:2.1.2" - peerDependenciesMeta: - supports-color: - optional: true - checksum: 10c0/cedbec45298dd5c501d01b92b119cd3faebe5438c3917ff11ae1bff86a6c722930ac9c8659792824013168ba6db7c4668225d845c633fbdafbbf902a6389f736 - languageName: node - linkType: hard - "deep-is@npm:^0.1.3": version: 0.1.4 resolution: "deep-is@npm:0.1.4" @@ -4942,7 +4942,7 @@ __metadata: languageName: node linkType: hard -"resolve@npm:^1.10.0, resolve@npm:^1.22.4": +"resolve@npm:*, resolve@npm:^1.10.0, resolve@npm:^1.22.4": version: 1.22.8 resolution: "resolve@npm:1.22.8" dependencies: @@ -4955,7 +4955,7 @@ __metadata: languageName: node linkType: hard -"resolve@patch:resolve@npm%3A^1.10.0#optional!builtin, resolve@patch:resolve@npm%3A^1.22.4#optional!builtin": +"resolve@patch:resolve@npm%3A*#optional!builtin, resolve@patch:resolve@npm%3A^1.10.0#optional!builtin, resolve@patch:resolve@npm%3A^1.22.4#optional!builtin": version: 1.22.8 resolution: "resolve@patch:resolve@npm%3A1.22.8#optional!builtin::version=1.22.8&hash=c3c19d" dependencies: @@ -5521,6 +5521,7 @@ __metadata: vite: "npm:^5.1.1" vite-bundle-analyzer: "npm:^0.7.0" vue: "npm:3.4.14" + vue-eslint-parser: "npm:^9.4.2" vue-router: "npm:^4.2.5" vue-tsc: "npm:^1.8.27" languageName: unknown