-
Notifications
You must be signed in to change notification settings - Fork 31
/
index.js
113 lines (113 loc) · 5.7 KB
/
index.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
module.exports = {
overrides: [
{
files: ['*.ts', '*.tsx'],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaFeatures: {
jsx: true,
},
project: './**/tsconfig.json',
},
plugins: ['@typescript-eslint'],
rules: {
'@typescript-eslint/adjacent-overload-signatures': 'error',
'@typescript-eslint/array-type': [
'error',
{
default: 'array-simple',
readonly: 'array-simple',
},
],
'@typescript-eslint/await-thenable': 'warn',
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/ban-types': 'error',
'@typescript-eslint/naming-convention': 'off',
'@typescript-eslint/consistent-type-definitions': ['error', 'interface'],
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-member-accessibility': ['error', {accessibility: 'no-public'}],
'func-call-spacing': 'off',
'@typescript-eslint/func-call-spacing': 'error',
'@typescript-eslint/indent': 'off',
'@typescript-eslint/member-delimiter-style': [
'error',
{
multiline: {
delimiter: 'semi',
requireLast: true,
},
singleline: {
delimiter: 'comma',
requireLast: false,
},
},
],
'@typescript-eslint/member-ordering': 'warn',
'@typescript-eslint/no-array-constructor': 'error',
'no-empty-function': 'off',
// TS有类型检测,不会把空对象和空函数写错,所以关掉这个规则
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-empty-interface': 'warn',
'@typescript-eslint/no-explicit-any': 'off',
'no-extra-parens': 'off',
'@typescript-eslint/no-extra-parens': 'off',
'@typescript-eslint/no-extraneous-class': 'error',
'@typescript-eslint/no-floating-promises': 'off',
'@typescript-eslint/no-for-in-array': 'error',
'@typescript-eslint/no-inferrable-types': 'off',
'@typescript-eslint/no-magic-numbers': 'off',
'@typescript-eslint/no-misused-new': 'error',
'@typescript-eslint/no-namespace': 'error',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/consistent-type-assertions': 'error',
'@typescript-eslint/no-parameter-properties': 'off',
'@typescript-eslint/no-require-imports': 'error',
'@typescript-eslint/no-this-alias': 'error',
'@typescript-eslint/no-type-alias': 'off',
'@typescript-eslint/no-unnecessary-qualifier': 'error',
'@typescript-eslint/no-unnecessary-type-assertion': 'error',
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': [
'error',
{vars: 'all', args: 'after-used', ignoreRestSiblings: true},
],
'init-declarations': 'off',
'@typescript-eslint/init-declarations': ['error'],
'@typescript-eslint/no-use-before-define': 'error',
'@typescript-eslint/no-useless-constructor': 'error',
'@typescript-eslint/no-var-requires': 'error',
'@typescript-eslint/no-dupe-class-members': 'error',
'@typescript-eslint/no-duplicate-imports': 'error',
'@typescript-eslint/no-extra-non-null-assertion': 'error',
'@typescript-eslint/no-redeclare': 'error',
'@typescript-eslint/prefer-for-of': 'error',
'@typescript-eslint/prefer-function-type': 'error',
'@typescript-eslint/prefer-includes': 'warn',
'@typescript-eslint/prefer-namespace-keyword': 'error',
'@typescript-eslint/prefer-readonly': 'error',
'@typescript-eslint/prefer-regexp-exec': 'warn',
'@typescript-eslint/prefer-string-starts-ends-with': 'error',
'@typescript-eslint/promise-function-async': 'off',
'@typescript-eslint/require-array-sort-compare': 'off',
'@typescript-eslint/restrict-plus-operands': 'warn',
'@typescript-eslint/dot-notation': ['error', {allowIndexSignaturePropertyAccess: true}],
semi: 'off',
'@typescript-eslint/semi': 'error',
'@typescript-eslint/strict-boolean-expressions': 'off',
'@typescript-eslint/triple-slash-reference': 'error',
'@typescript-eslint/type-annotation-spacing': 'error',
'@typescript-eslint/unbound-method': 'off',
'@typescript-eslint/unified-signatures': 'warn',
// 和TS的规则冲突
'no-undef': 'off',
'require-await': 'off',
'no-use-before-define': 'off',
'no-dupe-class-members': 'off',
'no-duplicate-imports': 'off',
'no-useless-constructor': 'off',
'no-redeclare': 'off',
'dot-notation': 'off',
},
},
],
};