UI/细节调整
This commit is contained in:
@@ -0,0 +1,80 @@
|
||||
// ESLint 平坦配置 —— 落地 UI_DESIGN_SYSTEM.md 第 5 章的 D 系约束。
|
||||
// 依赖:eslint / eslint-plugin-vue / @vue/eslint-config-typescript(见 package.json devDependencies)
|
||||
// 运行:bun run lint
|
||||
import pluginVue from 'eslint-plugin-vue'
|
||||
import { defineConfigWithVueTs, vueTsConfigs } from '@vue/eslint-config-typescript'
|
||||
|
||||
export default defineConfigWithVueTs(
|
||||
{
|
||||
ignores: [
|
||||
'dist/**',
|
||||
'node_modules/**',
|
||||
'src-tauri/**',
|
||||
'release_stage/**',
|
||||
'ThingHK/**',
|
||||
],
|
||||
},
|
||||
|
||||
// flat/essential:只保留「防错」规则(v-for key、重复 attr 等),
|
||||
// 不含缩进/引号等格式规则 —— 3183 条里 3038 条是格式噪音,与既有代码风格无关
|
||||
pluginVue.configs['flat/essential'],
|
||||
vueTsConfigs.recommended,
|
||||
|
||||
{
|
||||
rules: {
|
||||
// ---- D2:禁止 Tailwind 原生色阶,必须使用语义 token ----
|
||||
'no-restricted-syntax': [
|
||||
'error',
|
||||
{
|
||||
selector:
|
||||
"Literal[value=/(bg|text|border|ring|fill|stroke)-(slate|gray|zinc|neutral|stone|red|orange|amber|yellow|lime|green|emerald|teal|cyan|sky|blue|indigo|violet|purple|fuchsia|pink|rose)-[0-9]{2,3}(\\/[0-9]{1,3})?/]",
|
||||
message:
|
||||
'D2 禁止 Tailwind 原生色阶:请使用语义 token(bg-card / text-success-text / border-border 等),见 UI_DESIGN_SYSTEM.md',
|
||||
},
|
||||
{
|
||||
// D9:生产代码禁止外部字体 CDN
|
||||
selector:
|
||||
"Literal[value=/@import\\s+url\\(['\\\"]?https:\\/\\/(fonts\\.googleapis|fonts\\.gstatic)\\./]",
|
||||
message: 'D9 禁止外部字体 CDN:使用系统字体栈',
|
||||
},
|
||||
],
|
||||
|
||||
// ---- 未使用变量:_ 前缀豁免(Pinia action 占位、解构占位等惯例)----
|
||||
'@typescript-eslint/no-unused-vars': [
|
||||
'error',
|
||||
{
|
||||
argsIgnorePattern: '^_',
|
||||
varsIgnorePattern: '^_',
|
||||
caughtErrors: 'none',
|
||||
},
|
||||
],
|
||||
|
||||
// ---- Vue 风格:与既有代码一致 ----
|
||||
'vue/multi-word-component-names': 'off',
|
||||
'vue/max-attributes-per-line': 'off',
|
||||
'vue/singleline-html-element-content-newline': 'off',
|
||||
'vue/html-self-closing': 'off',
|
||||
'vue/attributes-order': 'off',
|
||||
},
|
||||
},
|
||||
|
||||
// .d.ts 声明文件:Vue 官方模板的 ImportMetaEnv 写法使用 {} 与 any,豁免
|
||||
{
|
||||
files: ['**/*.d.ts'],
|
||||
rules: {
|
||||
'@typescript-eslint/no-empty-object-type': 'off',
|
||||
'@typescript-eslint/no-explicit-any': 'off',
|
||||
},
|
||||
},
|
||||
|
||||
// feiniuStore 是飞牛 NAS 的 API 适配层:后端原始结构未在前端定型(字段类型化需对接 Rust 端),
|
||||
// 边界层暂豁免 no-explicit-any;定型后应移除此豁免
|
||||
{
|
||||
files: ['src/stores/feiniuStore.ts'],
|
||||
rules: {
|
||||
'@typescript-eslint/no-explicit-any': 'off',
|
||||
},
|
||||
},
|
||||
|
||||
// xterm 等第三方深色区域如需豁免,在下方追加 overrides
|
||||
)
|
||||
Reference in New Issue
Block a user