-
Notifications
You must be signed in to change notification settings - Fork 1
/
.eslintrc.cjs
66 lines (63 loc) · 1.56 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
module.exports = {
env: {
browser: true,
es2021: true,
node: true,
},
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
// 插件 eslint-config-prettier 相关配置
'prettier',
],
overrides: [
{
// 不检查 no-unused-expressions
files: ['*.json', '*.cjs'],
rules: {
'no-unused-expressions': 'off',
},
},
],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
},
plugins: [
'@typescript-eslint',
'simple-import-sort',
// 插件 eslint-plugin-prettier 相关配置
'prettier',
],
rules: {
// 插件 eslint-plugin-simple-import-sort 相关配置
'simple-import-sort/imports': 'error',
'simple-import-sort/exports': 'error',
// 其他主要配置
'quote-props': ['error', 'consistent-as-needed'],
'@typescript-eslint/ban-types': 0,
'@typescript-eslint/no-unused-vars': 'warn',
'@typescript-eslint/no-explicit-any': 0,
'prefer-const': 'warn',
indent: ['error', 2],
'no-multiple-empty-lines': 2,
'lines-around-comment': [
'error',
{
beforeBlockComment: true,
afterBlockComment: true,
beforeLineComment: true,
afterLineComment: false,
allowBlockStart: true,
allowBlockEnd: true,
allowObjectStart: true,
allowObjectEnd: true,
allowArrayStart: true,
allowArrayEnd: true,
},
],
// 插件 eslint-plugin-prettier 相关配置
'prettier/prettier': 'error',
},
}