diff --git a/.gitignore b/.gitignore index 4340584..2bda502 100644 --- a/.gitignore +++ b/.gitignore @@ -15,6 +15,7 @@ dist-ssr # 忽略所有 .mp4 文件 *.mp4 public/video/* +public/audio/* # Editor directories and files .vscode/* diff --git a/.prettierrc b/.prettierrc index 5c25189..ebb7562 100644 --- a/.prettierrc +++ b/.prettierrc @@ -2,11 +2,14 @@ "semi": false, "singleQuote": true, "tabWidth": 2, + "useTabs": false, "trailingComma": "none", "printWidth": 100, "endOfLine": "lf", "arrowParens": "avoid", "bracketSpacing": true, "bracketSameLine": false, - "vueIndentScriptAndStyle": false + "htmlWhitespaceSensitivity": "ignore", + "vueIndentScriptAndStyle": false, + "singleAttributePerLine": false } diff --git a/.prettierrc.json b/.prettierrc.json index b61c42f..ebb7562 100644 --- a/.prettierrc.json +++ b/.prettierrc.json @@ -1,15 +1,15 @@ { - "printWidth": 100, - "tabWidth": 2, - "useTabs": true, "semi": false, "singleQuote": true, + "tabWidth": 2, + "useTabs": false, "trailingComma": "none", + "printWidth": 100, + "endOfLine": "lf", + "arrowParens": "avoid", "bracketSpacing": true, - "bracketSameLine": true, - "arrowParens": "always", + "bracketSameLine": false, "htmlWhitespaceSensitivity": "ignore", "vueIndentScriptAndStyle": false, - "endOfLine": "auto", "singleAttributePerLine": false } diff --git a/eslint.config.ts b/eslint.config.ts index fb2fb92..082a3ee 100644 --- a/eslint.config.ts +++ b/eslint.config.ts @@ -2,11 +2,37 @@ import globals from 'globals' import tseslint from 'typescript-eslint' import pluginVue from 'eslint-plugin-vue' import { defineConfig } from 'eslint/config' +import { fileURLToPath } from 'node:url' + +// 直接使用 tsconfig 的绝对路径,避免中文路径在 URL/路径互转时被编码导致读取失败 +const tsconfigEslintPath = fileURLToPath(new URL('./tsconfig.eslint.json', import.meta.url)) export default defineConfig([ - { files: ['**/*.{js,mjs,cjs,ts,mts,cts,vue}'], languageOptions: { globals: globals.browser } }, + // 全局忽略:自身配置文件、产物、第三方静态资源等不参与 lint + { + ignores: [ + 'eslint.config.ts', + 'eslint.config.*', + 'dist/**', + 'node_modules/**', + 'public/**', + 'vite.config.*', + 'postcss.config.*', + 'tailwind.config.*' + ] + }, + { + files: ['**/*.{js,mjs,cjs,ts,mts,cts,tsx,vue}'], + languageOptions: { globals: globals.browser } + }, tseslint.configs.recommended, { + languageOptions: { + parserOptions: { + // 让 typescript-eslint 使用专用 tsconfig(显式 include .vue) + project: [tsconfigEslintPath] + } + }, rules: { '@typescript-eslint/no-explicit-any': 'off' } @@ -14,7 +40,19 @@ export default defineConfig([ pluginVue.configs['flat/essential'], { files: ['**/*.vue'], - languageOptions: { parserOptions: { parser: tseslint.parser } }, + languageOptions: { + parserOptions: { + parser: { + ts: tseslint.parser, + tsx: tseslint.parser + }, + project: [tsconfigEslintPath], + extraFileExtensions: ['.vue'], + ecmaFeatures: { + jsx: true + } + } + }, rules: { 'vue/multi-word-component-names': 'off', 'vue/no-undef-components': [ diff --git a/index.html b/index.html index 1f36676..067721c 100644 --- a/index.html +++ b/index.html @@ -8,10 +8,12 @@ content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0" /> +