diff --git a/.nvmrc b/.nvmrc index 25bf17f..0a47c85 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -18 \ No newline at end of file +lts/iron \ No newline at end of file diff --git a/eslint.config.js b/eslint.config.js index 32622cb..e206eab 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -3,28 +3,45 @@ import path from 'node:path' import { fileURLToPath } from 'node:url' -import js from '@eslint/js' +import eslint from '@eslint/js' import { FlatCompat } from '@eslint/eslintrc' import { includeIgnoreFile } from '@eslint/compat' - +import tseslint from 'typescript-eslint' +import eslintConfigPrettier from 'eslint-config-prettier' import pluginVue from 'eslint-plugin-vue' const __filename = fileURLToPath(import.meta.url) const __dirname = path.dirname(__filename) -const compat = new FlatCompat({ - baseDirectory: __dirname, - recommendedConfig: js.configs.recommended, - allConfig: js.configs.all, -}) - const gitignorePath = path.resolve(__dirname, '.gitignore') export default [ includeIgnoreFile(gitignorePath), - ...compat.extends('eslint:recommended', 'prettier'), + eslint.configs.recommended, + ...tseslint.configs.recommended, ...pluginVue.configs['flat/recommended'], + { + plugins: { + 'typescript-eslint': tseslint.plugin, + }, + languageOptions: { + parserOptions: { + parser: tseslint.parser, + project: './tsconfig.json', + extraFileExtensions: ['.vue'], + sourceType: 'module', + }, + }, + rules: { + '@typescript-eslint/no-explicit-any': 'off', + '@typescript-eslint/ban-ts-comment': 'off', + }, + }, + { + files: ['**/*.js'], + extends: [tseslint.configs.disableTypeChecked], + }, { files: ['src/**/*.(js|vue)'], languageOptions: { @@ -32,6 +49,6 @@ export default [ ...globals.node, }, }, - rules: {}, }, + eslintConfigPrettier, ] diff --git a/index.html b/index.html index e44e524..b1c0d11 100644 --- a/index.html +++ b/index.html @@ -54,7 +54,7 @@
- +
diff --git a/jsconfig.json b/jsconfig.json deleted file mode 100644 index b2c0e02..0000000 --- a/jsconfig.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "include": ["./src/**/*"] -} diff --git a/package.json b/package.json index df8de36..9aac3f6 100644 --- a/package.json +++ b/package.json @@ -8,13 +8,14 @@ "build": "NODE_OPTIONS=--openssl-legacy-provider vite build", "serve": "NODE_OPTIONS=--openssl-legacy-provider vite preview", "lint": "eslint --fix src", - "prepare": "husky install" + "prepare": "husky install", + "type-check": "vue-tsc --noEmit" }, "dependencies": { "@fortawesome/fontawesome-svg-core": "^1.2.36", "@fortawesome/free-solid-svg-icons": "^5.15.4", "@fortawesome/vue-fontawesome": "^3.0.5", - "axios": "^0.21.1", + "axios": "^1.7.2", "k-progress-v3": "^1.0.0", "regenerator-runtime": "^0.14.1", "vue": "^3.3.9", @@ -23,8 +24,11 @@ "vuex": "^4.1.0" }, "devDependencies": { + "@babel/types": "^7.24.7", "@eslint/compat": "^1.1.0", + "@types/node": "^20.14.8", "@vitejs/plugin-vue": "^5.0.5", + "@vue/tsconfig": "^0.5.1", "autoprefixer": "^10.4.19", "eslint": "^9.5.0", "eslint-config-prettier": "^9.1.0", @@ -35,7 +39,9 @@ "prettier": "^3.3.2", "tailwindcss": "^3.4.4", "typescript": "^5.5.2", - "vite": "^5.3.1" + "typescript-eslint": "^7.13.1", + "vite": "^5.3.1", + "vue-tsc": "^2.0.22" }, "browserslist": [ "> 1%", diff --git a/src/App.vue b/src/App.vue index bfb1e0e..be6fb26 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,46 +1,25 @@ - diff --git a/src/components/SpinTable.vue b/src/components/SpinTable.vue index fe03606..3fb5a1a 100644 --- a/src/components/SpinTable.vue +++ b/src/components/SpinTable.vue @@ -12,10 +12,12 @@
- diff --git a/src/components/SubjectCard.vue b/src/components/SubjectCard.vue deleted file mode 100644 index 1cf452f..0000000 --- a/src/components/SubjectCard.vue +++ /dev/null @@ -1,35 +0,0 @@ - - - - - diff --git a/src/components/Unit.vue b/src/components/Unit.vue index 70692e4..1ece5d0 100644 --- a/src/components/Unit.vue +++ b/src/components/Unit.vue @@ -1,65 +1,38 @@ - diff --git a/src/http.js b/src/http.js deleted file mode 100644 index 1fee5b7..0000000 --- a/src/http.js +++ /dev/null @@ -1,13 +0,0 @@ -import axios from 'axios' - -const axiosInstance = axios.create({ - baseURL: import.meta.env.VITE_BASE_SERVER_URL, -}) - -const accessToken = localStorage.getItem('accessToken') - -if (accessToken !== null) { - axiosInstance.defaults.headers.common['accesstoken'] = accessToken -} - -export default axiosInstance diff --git a/src/http.ts b/src/http.ts new file mode 100644 index 0000000..3a0c97a --- /dev/null +++ b/src/http.ts @@ -0,0 +1,17 @@ +import axios from 'axios' + +const axiosInstance = axios.create({ + baseURL: import.meta.env.VITE_BASE_SERVER_URL, +}) + +axiosInstance.interceptors.request.use((config) => { + const accessToken = localStorage.getItem('accessToken') + + if (accessToken) { + config.headers['accesstoken'] = accessToken + } + + return config +}) + +export default axiosInstance diff --git a/src/main.js b/src/main.ts similarity index 100% rename from src/main.js rename to src/main.ts diff --git a/src/modules/auth.js b/src/modules/auth.ts similarity index 85% rename from src/modules/auth.js rename to src/modules/auth.ts index bf026e3..0b70ad9 100644 --- a/src/modules/auth.js +++ b/src/modules/auth.ts @@ -1,4 +1,10 @@ import axiosInstance from '../http' +import type { Module } from 'vuex' + +interface IsAuthStore { + studentInfo: string | null + accessToken: string | null +} export default { namespaced: true, @@ -27,4 +33,4 @@ export default { return state.accessToken !== null }, }, -} +} as Module diff --git a/src/modules/theme.js b/src/modules/theme.ts similarity index 87% rename from src/modules/theme.js rename to src/modules/theme.ts index 1f8ce45..0e07bff 100644 --- a/src/modules/theme.js +++ b/src/modules/theme.ts @@ -1,3 +1,9 @@ +import type { Module } from 'vuex' + +interface ThemeStore { + theme: null | 'light' | 'dark' +} + export default { namespaced: true, state: { @@ -37,4 +43,4 @@ export default { return state.theme }, }, -} +} as Module diff --git a/src/pages/Login.vue b/src/pages/Login.vue index ee4755a..ab41aa8 100644 --- a/src/pages/Login.vue +++ b/src/pages/Login.vue @@ -73,11 +73,13 @@ diff --git a/src/pages/NotFound.vue b/src/pages/NotFound.vue index 5e628ef..fa28cee 100644 --- a/src/pages/NotFound.vue +++ b/src/pages/NotFound.vue @@ -25,15 +25,17 @@ -