From 60ce6d75f755125a331ecf33a1690d4ef5f1ab9e Mon Sep 17 00:00:00 2001 From: Benjamin Singleton <19498453+tetrogem@users.noreply.github.com> Date: Thu, 12 Feb 2026 01:18:14 -0600 Subject: [PATCH 01/15] feat: setup unplugin-vue-router, fixed eslnt config, SmartLink for type-safe internal/external links --- apps/vdn-static/eslint.config.js | 66 ++- apps/vdn-static/package.json | 9 +- apps/vdn-static/src/App.vue | 29 +- .../molecules/LearningResourceWrapper.vue | 91 ++-- .../src/components/organisms/SmartLink.vue | 18 + apps/vdn-static/src/main.ts | 2 +- .../pages/HomePage.vue => pages/index.vue} | 0 .../pages/KotobaPage.vue => pages/kotoba.vue} | 11 +- .../ResourcesPage.vue => pages/resources.vue} | 0 apps/vdn-static/src/router.ts | 10 + apps/vdn-static/src/routes/index.ts | 21 - apps/vdn-static/src/typed-router.d.ts | 3 + apps/vdn-static/tsconfig.app.json | 12 +- apps/vdn-static/vite.config.ts | 3 +- pnpm-lock.yaml | 469 +++++++++++------- 15 files changed, 434 insertions(+), 310 deletions(-) create mode 100644 apps/vdn-static/src/components/organisms/SmartLink.vue rename apps/vdn-static/src/{components/pages/HomePage.vue => pages/index.vue} (100%) rename apps/vdn-static/src/{components/pages/KotobaPage.vue => pages/kotoba.vue} (77%) rename apps/vdn-static/src/{components/pages/ResourcesPage.vue => pages/resources.vue} (100%) create mode 100644 apps/vdn-static/src/router.ts delete mode 100644 apps/vdn-static/src/routes/index.ts diff --git a/apps/vdn-static/eslint.config.js b/apps/vdn-static/eslint.config.js index 6bf661b..8d578f9 100644 --- a/apps/vdn-static/eslint.config.js +++ b/apps/vdn-static/eslint.config.js @@ -1,24 +1,44 @@ -import js from '@eslint/js'; -import globals from 'globals'; -import ts from 'typescript-eslint'; -import vue from 'eslint-plugin-vue'; +import js from "@eslint/js"; +import globals from "globals"; +import ts from "typescript-eslint"; +import vue from "eslint-plugin-vue"; +import { defineConfig, globalIgnores } from "eslint/config"; +import vueParser from "vue-eslint-parser"; -export default ts.config( - { ignores: ['dist'] }, - { - extends: [ - js.configs.recommended, - ...ts.configs.recommendedTypeChecked, - ...vue.configs.recommendedTypeChecked, - ], - files: ['**/*.{js,ts,vue}'], - languageOptions: { - ecmaVersion: 2020, - globals: globals.browser, - parserOptions: { - projectService: true, - tsconfigRootDir: import.meta.dirname, - }, - }, - }, -) +export default defineConfig([ + globalIgnores(["dist"]), + { + extends: [ + js.configs.recommended, + ts.configs.strictTypeChecked, + ...vue.configs["flat/essential"], + ], + files: ["./src/**/*.{js,ts,vue}"], + languageOptions: { + ecmaVersion: "latest", + sourceType: "module", + globals: globals.browser, + parser: vueParser, + parserOptions: { + projectService: true, + tsconfigRootDir: import.meta.dirname, + parser: ts.parser, + extraFileExtensions: [".vue"], + }, + }, + rules: { + "vue/no-restricted-component-names": [ + "error", + { + name: "RouterLink", + message: "Use SmartLink instead of RouterLink.", + }, + ], + }, + }, + // disable multi-word-component-names for unplugin-vue-router + { + files: ["src/pages/**/*.vue"], + rules: { "vue/multi-word-component-names": "off" }, + }, +]); diff --git a/apps/vdn-static/package.json b/apps/vdn-static/package.json index 25a0d3c..dce6538 100644 --- a/apps/vdn-static/package.json +++ b/apps/vdn-static/package.json @@ -22,17 +22,20 @@ "vue-router": "^4.5.1" }, "devDependencies": { + "@eslint/js": "^9.39.2", "@repo/common": "workspace:*", "@vitejs/plugin-vue": "^5.2.3", "@vue/tsconfig": "^0.7.0", - "eslint": "^9.26.0", - "eslint-plugin-vue": "^10.1.0", + "eslint": "^9.39.2", + "eslint-plugin-vue": "^10.7.0", + "globals": "^17.3.0", "prettier": "^3.5.3", "sass": "^1.87.0", "typescript": "~5.8.3", - "typescript-eslint": "^8.32.1", + "typescript-eslint": "^8.55.0", "unplugin-vue-router": "^0.12.0", "vite": "^6.3.5", + "vue-eslint-parser": "^10.2.0", "vue-tsc": "^2.2.8" }, "packageManager": "pnpm@10.11.0" diff --git a/apps/vdn-static/src/App.vue b/apps/vdn-static/src/App.vue index 21b089e..28bdd82 100644 --- a/apps/vdn-static/src/App.vue +++ b/apps/vdn-static/src/App.vue @@ -4,6 +4,8 @@ import { ref, type Ref } from "vue"; import LocalePicker from "./components/organisms/LocalePicker.vue"; import { vOnClickOutside } from "@vueuse/components"; import { useLocale } from "./i18n"; +import { RouterLink, useRouter } from "vue-router"; +import SmartLink from "./components/organisms/SmartLink.vue"; const burgerOpen: Ref = ref(false); @@ -16,6 +18,11 @@ const closeBurger = (): void => { }; const locale = useLocale(); + +const router = useRouter(); +router.beforeEach(() => { + closeBurger(); +});