-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.eslintrc.js
More file actions
89 lines (76 loc) · 2.16 KB
/
.eslintrc.js
File metadata and controls
89 lines (76 loc) · 2.16 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
module.exports = {
root: true,
env: {
node: true,
},
'extends': [
'plugin:vue/vue3-essential',
'eslint:recommended',
'@vue/typescript/recommended',
],
parserOptions: {
ecmaVersion: 2020,
},
rules: {
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'vue/no-deprecated-slot-attribute': 'off',
'@typescript-eslint/no-explicit-any': 'off',
// 多行逗号
'comma-dangle': ['warn', 'always-multiline'],
//if后必须加花括号
curly: 1,
//禁止条件表达式中出现赋值操作符
'no-cond-assign': 1,
//箭头函数括号适时省略
'arrow-parens': [1, 'as-needed'],
//不允许var,用let const代替
'no-var': 1,
// 能用const时不用let
'prefer-const': 1,
// 每个变量定义需要单独行
'one-var': [1, 'never'],
// 不允许定义未使用
'no-unused-vars': 1,
//对象属性使用点而不是方括号
// 'dot-notation': 1,
// 屏蔽无必要的字符串相加
'no-useless-concat': 'warn',
// 字符串使用字面量而不是加号连接
'prefer-template': 'warn',
// 不允许空函数体
'no-empty': 'warn',
// 块末插入空行
'padding-line-between-statements': ['warn', { blankLine: 'always', prev: 'block-like', next: '*' }],
//尽量使用对象简写
'object-shorthand': ['warn', 'always', { ignoreConstructors: true }],
// 回调函数必须使用箭头函数
'prefer-arrow-callback': 'warn',
// 尽量使用对象解构赋值
'prefer-destructuring': [
'warn',
{
object: true,
},
{
enforceForRenamedProperties: false,
},
],
//禁止在循环中声明函数
'no-loop-func': 'warn',
//禁止循环中出现await。应使用await Promise.all(results)将promise集合并行处理
'no-await-in-loop': 'warn',
'vue/no-unused-components':1,
},
overrides: [
{
files: [
'**/__tests__/*.{j,t}s?(x)',
'**/tests/unit/**/*.spec.{j,t}s?(x)',
],
env: {
jest: true,
},
},
],
}