-
Notifications
You must be signed in to change notification settings - Fork 2
/
.eslintrc.js
165 lines (163 loc) · 3.88 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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
/** @type {import('eslint').Rule.RuleModule} */
module.exports = {
env: {
browser: true,
es2021: true,
jest: true,
},
extends: [
'airbnb-base',
'airbnb-typescript/base',
// 'plugin:import/typescript',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 'es2021',
sourceType: 'module',
project: './tsconfig.eslint.json',
},
plugins: ['@typescript-eslint'],
rules: {
'no-console': 'off',
'@typescript-eslint/no-redeclare': 'off',
'@typescript-eslint/lines-between-class-members': 'off',
eqeqeq: ['error', 'smart'],
'max-len': [
'error',
{
ignoreStrings: true,
ignoreTemplateLiterals: true,
ignoreRegExpLiterals: true,
ignoreComments: true,
code: 100,
},
],
'array-bracket-newline': [
'error',
{
multiline: true,
minItems: 2,
},
],
'object-curly-newline': [
'error',
{
ObjectExpression: 'always',
ObjectPattern: {
multiline: true,
minProperties: 2,
},
ImportDeclaration: {
multiline: true,
minProperties: 2,
},
ExportDeclaration: 'never',
},
],
'function-paren-newline': [
'error',
{
minItems: 3,
},
],
'array-element-newline': [
'error',
{
ArrayExpression: {
minItems: 2,
multiline: true,
},
// "consistent",
ArrayPattern: {
minItems: 2,
multiline: true,
},
},
],
// 'lines-between-class-members': [
// 'error',
// 'always',
// {
// exceptAfterSingleLine: true,
// },
// ],
// 'padding-line-between-statements': [
// 'error',
// {
// blankLine: 'always',
// prev: ['const', 'let', 'var'],
// next: '*',
// },
// {
// blankLine: 'any',
// prev: ['const', 'let', 'var'],
// next: ['const', 'let', 'var'],
// },
// ],
'no-use-before-define': 'off',
'@typescript-eslint/no-use-before-define': 'off',
'@typescript-eslint/no-misused-new': 'error',
'@typescript-eslint/no-inferrable-types': 'warn',
'@typescript-eslint/member-delimiter-style': [
'error',
{
multiline: {
delimiter: 'semi',
requireLast: true,
},
singleline: {
delimiter: 'semi',
requireLast: false,
},
multilineDetection: 'brackets',
},
],
'import/prefer-default-export': 'off',
// consistent-type-imports
'@typescript-eslint/consistent-type-imports': [
'error',
{
prefer: 'type-imports',
},
],
'@typescript-eslint/consistent-indexed-object-style': ['error', 'record'],
'@typescript-eslint/member-ordering': [
'error',
{
default: [
'public-static-field',
'static-field',
'instance-field',
'signature',
'method',
'constructor',
'field',
],
},
],
'no-underscore-dangle': 'off',
// Promise & async checks
'@typescript-eslint/await-thenable': 'off',
'@typescript-eslint/no-floating-promises': [
'error',
{
ignoreVoid: true,
},
],
'@typescript-eslint/no-misused-promises': [
'error',
{
checksConditionals: true,
checksVoidReturn: true,
checksSpreads: true,
},
],
'@typescript-eslint/no-unnecessary-type-assertion': ['error'],
'@typescript-eslint/prefer-as-const': 'error',
'@typescript-eslint/prefer-includes': 'warn',
// NOTE: Disable "prefer-function-type" if annoying!
'@typescript-eslint/prefer-function-type': 'warn',
},
};