-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.cjs
100 lines (100 loc) · 2.72 KB
/
.eslintrc.cjs
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
module.exports = {
root: true,
env: {
browser: true, // 允许使用浏览器环境中的全局变量,如 window 和 document
node: true,
jasmine: true,
jest: true,
es6: true
},
// 'vue-eslint-parser' '@typescript-eslint/parser'
parser: '@typescript-eslint/parser',
parserOptions: {
// Use babel-eslint for JavaScript
parser: 'babel-eslint'
},
extends: [
'plugin:vue/vue3-recommended',
'plugin:import/recommended',
'plugin:@typescript-eslint/recommended',
'prettier'
],
plugins: ['@typescript-eslint', 'import', 'vue'],
overrides: [
{
files: ['*.ts', '*.tsx'],
extends: ['@vue/typescript/recommended', '@vue/prettier'],
rules: {
'@typescript-eslint/no-explicit-any': 0,
'@typescript-eslint/ban-types': 0,
'@typescript-eslint/consistent-type-imports': 'error',
'@typescript-eslint/explicit-module-boundary-types': 0,
'@typescript-eslint/no-empty-function': 0,
'@typescript-eslint/no-non-null-assertion': 0,
'@typescript-eslint/no-unused-vars': [
'error',
{ vars: 'all', args: 'after-used', ignoreRestSiblings: true }
],
'@typescript-eslint/ban-ts-comment': 0
}
},
{
files: ['*.vue'],
parser: 'vue-eslint-parser',
parserOptions: {
parser: '@typescript-eslint/parser' // 使用 @typescript-eslint/parser 解析 TypeScript 代码
},
rules: {
'no-console': 'off',
'vue/no-use-v-if-with-v-for': 'off',
'@typescript-eslint/no-unused-vars': [
'error',
{ vars: 'all', args: 'after-used', ignoreRestSiblings: true }
]
}
}
],
rules: {
'import/no-named-as-default': 'off',
'import/namespace': 0,
'import/no-named-as-default-member': 'off',
'import/no-unresolved': 0,
'comma-dangle': 0,
'no-var': 'error',
'no-console': 'off',
'object-shorthand': 2,
'no-unused-vars': [
2,
{ ignoreRestSiblings: true, argsIgnorePattern: '^_' }
],
'no-undef': 0,
camelcase: 'off',
'no-extra-boolean-cast': 'off',
semi: 0,
'vue/no-v-html': 'off',
'vue/require-explicit-emits': 'off',
'vue/require-prop-types': 'off',
'vue/require-default-prop': 'off',
'vue/no-reserved-keys': 'off',
'vue/comment-directive': 'off',
'vue/prop-name-casing': 'off',
'vue/one-component-per-file': 'off',
'vue/custom-event-name-casing': 'off',
'vue/v-on-event-hyphenation': 'off',
'vue/max-attributes-per-line': [
'error',
{
singleline: {
max: 12
},
multiline: {
max: 12
}
}
],
'vue/multi-word-component-names': 'off'
},
globals: {
h: true
}
}