-
Notifications
You must be signed in to change notification settings - Fork 271
Expand file tree
/
Copy path.eslintrc.js
More file actions
48 lines (45 loc) · 990 Bytes
/
.eslintrc.js
File metadata and controls
48 lines (45 loc) · 990 Bytes
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
module.exports = {
env: {
browser: true,
es2021: true,
node: true,
mocha: true
},
extends: [
'eslint:recommended'
],
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module'
},
rules: {
// 代码风格
'indent': ['error', 2],
'linebreak-style': ['error', 'unix'],
'quotes': ['error', 'single'],
'semi': ['error', 'always'],
// 最佳实践
'no-console': 'warn',
'no-unused-vars': 'error',
'no-undef': 'error',
'prefer-const': 'error',
'no-var': 'error',
// ES6+
'arrow-spacing': 'error',
'prefer-arrow-callback': 'error',
'prefer-template': 'error',
// 代码质量
'eqeqeq': 'error',
'no-duplicate-imports': 'error',
'no-unreachable': 'error'
},
globals: {
'describe': 'readonly',
'it': 'readonly',
'expect': 'readonly',
'beforeEach': 'readonly',
'afterEach': 'readonly',
'before': 'readonly',
'after': 'readonly'
}
};