mirror of
https://github.com/fawney19/Aether.git
synced 2026-01-02 15:52:26 +08:00
refactor(frontend): 优化配置和类型定义
- 更新 ESLint 配置 - 优化 Vue 类型声明文件
This commit is contained in:
@@ -116,6 +116,33 @@ export default [
|
|||||||
ImageData: 'readonly',
|
ImageData: 'readonly',
|
||||||
Path2D: 'readonly',
|
Path2D: 'readonly',
|
||||||
OffscreenCanvas: 'readonly',
|
OffscreenCanvas: 'readonly',
|
||||||
|
// 更多 DOM 类型
|
||||||
|
HTMLButtonElement: 'readonly',
|
||||||
|
HTMLTextAreaElement: 'readonly',
|
||||||
|
MediaQueryList: 'readonly',
|
||||||
|
MediaQueryListEvent: 'readonly',
|
||||||
|
FocusEvent: 'readonly',
|
||||||
|
DragEvent: 'readonly',
|
||||||
|
PointerEvent: 'readonly',
|
||||||
|
TouchEvent: 'readonly',
|
||||||
|
WheelEvent: 'readonly',
|
||||||
|
AnimationEvent: 'readonly',
|
||||||
|
TransitionEvent: 'readonly',
|
||||||
|
ClipboardEvent: 'readonly',
|
||||||
|
InputEvent: 'readonly',
|
||||||
|
CompositionEvent: 'readonly',
|
||||||
|
UIEvent: 'readonly',
|
||||||
|
ProgressEvent: 'readonly',
|
||||||
|
ErrorEvent: 'readonly',
|
||||||
|
StorageEvent: 'readonly',
|
||||||
|
PopStateEvent: 'readonly',
|
||||||
|
HashChangeEvent: 'readonly',
|
||||||
|
PageTransitionEvent: 'readonly',
|
||||||
|
BeforeUnloadEvent: 'readonly',
|
||||||
|
MessageEvent: 'readonly',
|
||||||
|
SecurityPolicyViolationEvent: 'readonly',
|
||||||
|
DeviceMotionEvent: 'readonly',
|
||||||
|
DeviceOrientationEvent: 'readonly',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -134,10 +161,10 @@ export default [
|
|||||||
rules: {
|
rules: {
|
||||||
// Vue 规则
|
// Vue 规则
|
||||||
'vue/multi-word-component-names': 'off',
|
'vue/multi-word-component-names': 'off',
|
||||||
'vue/no-v-html': 'error',
|
'vue/no-v-html': 'warn', // 降级为警告,某些场景需要使用
|
||||||
'vue/component-api-style': ['error', ['script-setup']],
|
'vue/component-api-style': ['error', ['script-setup']],
|
||||||
'vue/component-name-in-template-casing': ['error', 'PascalCase'],
|
'vue/component-name-in-template-casing': ['error', 'PascalCase'],
|
||||||
'vue/custom-event-name-casing': ['error', 'camelCase'],
|
'vue/custom-event-name-casing': ['warn', 'camelCase'], // 降级为警告,逐步迁移
|
||||||
'vue/define-macros-order': [
|
'vue/define-macros-order': [
|
||||||
'error',
|
'error',
|
||||||
{
|
{
|
||||||
@@ -145,7 +172,7 @@ export default [
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
'vue/html-comment-content-spacing': ['error', 'always'],
|
'vue/html-comment-content-spacing': ['error', 'always'],
|
||||||
'vue/no-unused-refs': 'error',
|
'vue/no-unused-refs': 'warn', // 降级为警告
|
||||||
'vue/no-useless-v-bind': 'error',
|
'vue/no-useless-v-bind': 'error',
|
||||||
'vue/padding-line-between-blocks': ['error', 'always'],
|
'vue/padding-line-between-blocks': ['error', 'always'],
|
||||||
'vue/prefer-separate-static-class': 'error',
|
'vue/prefer-separate-static-class': 'error',
|
||||||
@@ -183,4 +210,12 @@ export default [
|
|||||||
'prefer-arrow-callback': 'error',
|
'prefer-arrow-callback': 'error',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// 允许 main.ts 和 logger.ts 使用 console
|
||||||
|
{
|
||||||
|
files: ['**/main.ts', '**/logger.ts'],
|
||||||
|
rules: {
|
||||||
|
'no-console': 'off',
|
||||||
|
},
|
||||||
|
},
|
||||||
]
|
]
|
||||||
|
|||||||
5
frontend/src/shims-vue.d.ts
vendored
5
frontend/src/shims-vue.d.ts
vendored
@@ -1,5 +1,6 @@
|
|||||||
declare module '*.vue' {
|
declare module '*.vue' {
|
||||||
import type { DefineComponent } from 'vue'
|
import type { DefineComponent } from 'vue'
|
||||||
const component: DefineComponent<{}, {}, any>
|
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
||||||
|
const component: DefineComponent<{}, {}, unknown>
|
||||||
export default component
|
export default component
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user