-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Expand file tree
/
Copy patheslint.config.mjs
More file actions
71 lines (61 loc) · 2.12 KB
/
eslint.config.mjs
File metadata and controls
71 lines (61 loc) · 2.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import js from '@eslint/js'
import pluginVue from 'eslint-plugin-vue'
import { defineConfigWithVueTs, vueTsConfigs } from '@vue/eslint-config-typescript'
import vuePrettierConfig from '@vue/eslint-config-prettier'
import globals from 'globals'
export default defineConfigWithVueTs(
{
ignores: ['node_modules', 'dist', 'out', '.gitignore'],
},
// ESLint 推荐规则
js.configs.recommended,
// Vue 3 推荐规则(flat config 格式)
...pluginVue.configs['flat/recommended'],
// Vue + TypeScript 推荐规则
vueTsConfigs.recommended,
// 全局环境变量(替代 @electron-toolkit 基础配置中的 env 设置)
{
languageOptions: {
ecmaVersion: 2021,
sourceType: 'module',
globals: {
...globals.browser,
...globals.node,
...globals.commonjs,
...globals.es2021,
},
parserOptions: {
ecmaFeatures: { jsx: true },
},
},
},
// Prettier(@vue/eslint-config-prettier v10+ 已是 flat config 格式)
vuePrettierConfig,
// 自定义规则
{
rules: {
// Vue 规则放宽
'vue/require-default-prop': 'off',
'vue/multi-word-component-names': 'off',
// 项目中有受控的 HTML 渲染场景(如 Markdown/高亮结果),统一关闭该告警。
'vue/no-v-html': 'off',
// TypeScript 规则放宽(项目约定)
'@typescript-eslint/no-unused-vars': 'off',
'@typescript-eslint/no-explicit-any': 'off',
// 来自 @electron-toolkit/eslint-config-ts/eslint-recommended
'@typescript-eslint/ban-ts-comment': ['error', { 'ts-ignore': 'allow-with-description' }],
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-empty-function': ['error', { allow: ['arrowFunctions'] }],
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-var-requires': 'off',
},
},
// E2E Node helper/test 使用 CommonJS,允许 require
{
files: ['tests/e2e/**/*.js'],
rules: {
'@typescript-eslint/no-require-imports': 'off',
},
}
)