forked from LLiuHuan/arco-design-pro-vue
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.js
145 lines (143 loc) · 3.99 KB
/
.eslintrc.js
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
module.exports = {
root: true,
parserOptions: {
ecmaVersion: 2020,
parser: '@typescript-eslint/parser',
sourceType: 'module',
},
parser: 'vue-eslint-parser',
overrides: [
{
files: ['*.vue'],
rules: {
'no-undef': 'off',
},
},
{
files: ['*.html'],
rules: {
'vue/comment-directive': 'off',
},
},
],
env: {
browser: true,
es2020: true,
node: true,
'vue/setup-compiler-macros': true,
},
extends: [
'plugin:vue/vue3-recommended',
'plugin:@typescript-eslint/recommended',
'prettier',
'plugin:prettier/recommended',
],
globals: {
PROJECT_BUILD_TIME: 'readonly',
AMap: 'readonly',
BMap: 'readonly',
TMap: 'readonly',
},
plugins: ['vue', '@typescript-eslint'],
rules: {
'import/extensions': 'off', // import x from './m' 关闭m没有后缀的告警
'import/no-extraneous-dependencies': 'off',
'import/no-useless-path-segments': 'off',
'import/no-unresolved': 'off',
'import/prefer-default-export': 'off',
'max-classes-per-file': 'off',
'class-methods-use-this': 'off',
'no-param-reassign': 'off',
'no-shadow': 'off',
'no-unused-vars': 'off',
'no-use-before-define': 'off',
'no-unused-expressions': 'off',
'vue/multi-word-component-names': [
'error',
{
ignores: ['index'],
},
],
'vue/custom-event-name-casing': 'off',
'@typescript-eslint/ban-ts-ignore': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/ban-types': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'space-before-function-paren': 'off',
'vue/attributes-order': 'off',
'vue/one-component-per-file': 'off',
'vue/html-closing-bracket-newline': 'off',
'vue/max-attributes-per-line': 'off',
'vue/multiline-html-element-content-newline': 'off',
'vue/singleline-html-element-content-newline': 'off',
'vue/attribute-hyphenation': 'off',
'vue/require-default-prop': 'off',
'vue/script-setup-uses-vars': 'off',
'vue/html-self-closing': [
'error',
{
html: {
void: 'always',
normal: 'never',
component: 'always',
},
svg: 'always',
math: 'always',
},
],
'@typescript-eslint/no-empty-interface': [
'error',
{
allowSingleExtends: true,
},
],
'@typescript-eslint/no-shadow': 'error',
'@typescript-eslint/no-unused-vars': [
'warn',
{ ignoreRestSiblings: true, varsIgnorePattern: '^_' },
],
'@typescript-eslint/no-use-before-define': [
'error',
{ classes: true, functions: false, typedefs: false },
],
'valid-typeof': 'off', // ts(2367)
// 定义对象的set存取器属性时,强制定义get
'accessor-pairs': 2,
// 指定数组的元素之间要以空格隔开(,后面), never参数:[ 之前和 ] 之后不能带空格,always参数:[ 之前和 ] 之后必须带空格
'array-bracket-spacing': [2, 'never'],
// 在块级作用域外访问块内定义的变量是否报错提示
'block-scoped-var': 0,
// 文件末尾强制换行
// 使用 === 替代 ==
eqeqeq: [2, 'allow-null'],
'no-console': 2, //禁止使用console
'eol-last': 2,
// 'vue/multi-word-component-names': [
// 'error',
// {
// ignores: [
// 'Layout',
// 'Logo',
// '403',
// '404',
// '500',
// 'Menu',
// 'Redirect',
// 'Monitor',
// 'About',
// 'Settings',
// 'Login',
// 'State',
// 'Application',
// 'Chart',
// 'Breadcrumb',
// ],
// },
// ],
},
};