chore(web): eslint flat-config + prettier setup

This commit is contained in:
2026-04-29 07:41:51 +08:00
parent aef7b0b661
commit 35b812e594
8 changed files with 60 additions and 4 deletions
+1
View File
@@ -14,6 +14,7 @@ coverage.html
/web/dist/
/web/*.tsbuildinfo
/web/*.js
!/web/eslint.config.js
/web/*.d.ts
/web/src/**/*.js
/web/src/**/*.d.ts
+7
View File
@@ -0,0 +1,7 @@
node_modules
dist
pnpm-lock.yaml
*.tsbuildinfo
*.d.ts
vite.config.js
src/**/*.js
+6
View File
@@ -0,0 +1,6 @@
{
"semi": false,
"singleQuote": true,
"trailingComma": "all",
"printWidth": 100
}
+37
View File
@@ -0,0 +1,37 @@
// ESLint v10 flat config。
// 覆盖范围:src/、test/ 下的 .vue/.ts/.tsx 文件。dist/、node_modules、配置类
// 文件 (vite.config.ts、postcss.config.js 等) 默认走 ignore。
import js from '@eslint/js'
import tseslint from 'typescript-eslint'
import vue from 'eslint-plugin-vue'
import vueParser from 'vue-eslint-parser'
export default [
{
ignores: ['dist/**', 'node_modules/**', '**/*.d.ts', 'src/**/*.js', 'vite.config.js'],
},
js.configs.recommended,
...tseslint.configs.recommended,
...vue.configs['flat/recommended'],
{
files: ['**/*.vue'],
languageOptions: {
parser: vueParser,
parserOptions: {
parser: tseslint.parser,
ecmaVersion: 2022,
sourceType: 'module',
},
},
},
{
files: ['**/*.{ts,tsx,vue}'],
rules: {
'vue/multi-word-component-names': 'off',
'@typescript-eslint/no-unused-vars': [
'error',
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_' },
],
},
},
]
+2 -1
View File
@@ -10,7 +10,7 @@
"preview": "vite preview",
"test": "vitest run",
"test:watch": "vitest",
"lint": "eslint . --ext .vue,.ts,.tsx",
"lint": "eslint .",
"format": "prettier -w .",
"typecheck": "vue-tsc --noEmit"
},
@@ -41,6 +41,7 @@
"typescript-eslint": "^8.59.1",
"vite": "^8.0.10",
"vitest": "^4.1.5",
"vue-eslint-parser": "^10.4.0",
"vue-tsc": "^3.2.7"
}
}
+3
View File
@@ -69,6 +69,9 @@ importers:
vitest:
specifier: ^4.1.5
version: 4.1.5(@types/node@25.6.0)(happy-dom@20.9.0)(vite@8.0.10(@types/node@25.6.0)(jiti@2.6.1)(yaml@2.8.3))
vue-eslint-parser:
specifier: ^10.4.0
version: 10.4.0(eslint@10.2.1(jiti@2.6.1))
vue-tsc:
specifier: ^3.2.7
version: 3.2.7(typescript@6.0.3)
+1 -1
View File
@@ -1,3 +1,3 @@
@import "tailwindcss";
@import 'tailwindcss';
@variant dark (&:where(.dark, .dark *));
+3 -2
View File
@@ -15,6 +15,7 @@
body {
background: var(--color-bg);
color: var(--color-fg);
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue",
Arial, "Microsoft YaHei", sans-serif;
font-family:
-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, 'Microsoft YaHei',
sans-serif;
}