@@ -10,9 +10,74 @@ import prettier from "eslint-plugin-prettier/recommended";
10
10
import promise from "eslint-plugin-promise" ;
11
11
12
12
import eslintPluginUnicorn from "eslint-plugin-unicorn" ;
13
- import globals from "globals" ;
14
13
import tseslint from "typescript-eslint" ;
15
14
15
+ const sharedRules = {
16
+ "arrow-body-style" : [ "error" , "always" ] ,
17
+
18
+ curly : [ "error" , "all" ] ,
19
+ "eol-last" : [ "error" , "always" ] ,
20
+ eqeqeq : [ "error" , "always" ] ,
21
+
22
+ "max-len" : [ "off" ] ,
23
+ "no-extra-semi" : [ "off" ] ,
24
+ "no-param-reassign" : [ "off" ] ,
25
+ "no-restricted-imports" : [
26
+ "error" ,
27
+ {
28
+ patterns : [ ".*" ] ,
29
+ } ,
30
+ ] ,
31
+ "no-restricted-syntax" : [ "error" , "DebuggerStatement" , "LabeledStatement" , "WithStatement" ] ,
32
+ "no-return-await" : [ "error" ] ,
33
+ "no-shadow" : [ "error" ] ,
34
+ "no-underscore-dangle" : [ "off" ] ,
35
+ "no-unused-expressions" : [ "error" ] ,
36
+ "no-useless-constructor" : [ "off" ] ,
37
+ "object-shorthand" : [ "error" , "always" ] ,
38
+ "prefer-template" : [ "error" ] ,
39
+ quotes : [
40
+ "error" ,
41
+ "double" ,
42
+ {
43
+ allowTemplateLiterals : false ,
44
+ avoidEscape : true ,
45
+ } ,
46
+ ] ,
47
+ "require-await" : [ "error" ] ,
48
+ "sort-imports" : [
49
+ "error" ,
50
+ {
51
+ ignoreDeclarationSort : true ,
52
+ } ,
53
+ ] ,
54
+
55
+ "sort-keys" : [ "off" ] ,
56
+ "unicorn/no-null" : [ "off" ] ,
57
+ "unicorn/prefer-ternary" : [ "off" ] ,
58
+
59
+ "import/extensions" : [
60
+ "error" ,
61
+ "never" ,
62
+ {
63
+ json : "always" ,
64
+ } ,
65
+ ] ,
66
+ "import/newline-after-import" : [ "error" ] ,
67
+ "import/no-cycle" : [ "off" ] ,
68
+ "import/no-extraneous-dependencies" : [ "off" ] ,
69
+ "import/no-relative-packages" : [ "error" ] ,
70
+ "import/no-unresolved" : [ "error" ] ,
71
+ "import/order" : [
72
+ "error" ,
73
+ {
74
+ alphabetize : { caseInsensitive : true , order : "asc" } ,
75
+ "newlines-between" : "always-and-inside-groups" ,
76
+ } ,
77
+ ] ,
78
+ "import/prefer-default-export" : [ "off" ] ,
79
+ } ;
80
+
16
81
export default tseslint . config (
17
82
js . configs . recommended ,
18
83
{
@@ -46,80 +111,12 @@ export default tseslint.config(
46
111
...importPlugin . configs . recommended . rules ,
47
112
...eslintPluginUnicorn . configs . recommended . rules ,
48
113
49
- "import/export" : [ "error" ] ,
50
- "import/first" : [ "error" ] ,
51
- "import/no-absolute-path" : [ "error" , { esmodule : true , commonjs : true , amd : false } ] ,
52
- "import/no-duplicates" : [ "error" ] ,
53
- "import/no-named-default" : [ "error" ] ,
54
- "import/no-webpack-loader-syntax" : [ "error" ] ,
55
- "arrow-body-style" : [ "error" , "always" ] ,
56
-
57
- curly : [ "error" , "all" ] ,
58
- "eol-last" : [ "error" , "always" ] ,
59
- eqeqeq : [ "error" , "always" ] ,
60
-
61
- "max-len" : [ "off" ] ,
62
- "no-dupe-keys" : [ "warn" ] ,
63
- "no-extra-semi" : [ "off" ] ,
64
- "no-param-reassign" : [ "off" ] ,
65
- "no-restricted-imports" : [
66
- "error" ,
67
- {
68
- patterns : [ ".*" ] ,
69
- } ,
70
- ] ,
71
- "no-restricted-syntax" : [ "error" , "DebuggerStatement" , "LabeledStatement" , "WithStatement" ] ,
72
- "no-return-await" : [ "error" ] ,
73
- "no-shadow" : [ "error" ] ,
74
- "no-underscore-dangle" : [ "off" ] ,
75
- "no-unused-expressions" : [ "error" ] ,
76
- "no-useless-constructor" : [ "off" ] ,
77
- "object-shorthand" : [ "error" , "always" ] ,
78
- "prefer-const" : [ "error" ] ,
79
- "prefer-template" : [ "error" ] ,
80
- quotes : [
81
- "error" ,
82
- "double" ,
83
- {
84
- allowTemplateLiterals : false ,
85
- avoidEscape : true ,
86
- } ,
87
- ] ,
88
- "require-await" : [ "error" ] ,
89
- "sort-imports" : [
90
- "error" ,
91
- {
92
- ignoreDeclarationSort : true ,
93
- } ,
94
- ] ,
95
-
96
- "sort-keys" : [ "off" ] ,
97
- "unicorn/no-null" : [ "off" ] ,
98
- "unicorn/prefer-ternary" : [ "off" ] ,
99
-
100
- "import/extensions" : [
101
- "error" ,
102
- "never" ,
103
- {
104
- json : "always" ,
105
- } ,
106
- ] ,
107
- "import/newline-after-import" : [ "error" ] ,
108
- "import/no-cycle" : [ "off" ] ,
109
- "import/no-extraneous-dependencies" : [ "off" ] ,
110
- "import/no-relative-packages" : [ "error" ] ,
111
- "import/no-unresolved" : [ "error" ] ,
112
- "import/order" : [
113
- "error" ,
114
- {
115
- alphabetize : { caseInsensitive : true , order : "asc" } ,
116
- "newlines-between" : "always-and-inside-groups" ,
117
- } ,
118
- ] ,
119
- "import/prefer-default-export" : [ "off" ] ,
114
+ ...sharedRules ,
120
115
} ,
121
116
} ,
122
117
...tseslint . configs . strictTypeChecked ,
118
+ ...tseslint . configs . recommendedTypeChecked ,
119
+ ...tseslint . configs . stylisticTypeChecked ,
123
120
{
124
121
files : [ "**/*.ts" , "**/*.tsx" ] ,
125
122
ignores : [ "**/*.mjs" ] ,
@@ -154,9 +151,11 @@ export default tseslint.config(
154
151
rules : {
155
152
...importPlugin . configs . typescript . rules ,
156
153
...love . rules ,
154
+ ...sharedRules ,
155
+
156
+ "no-return-await" : [ "off" ] ,
157
157
158
158
"@stylistic/ts/no-extra-semi" : [ "error" ] ,
159
- "@typescript-eslint/array-type" : [ "error" , { default : "array" } ] ,
160
159
161
160
"@typescript-eslint/consistent-type-imports" : [
162
161
"error" ,
@@ -165,51 +164,14 @@ export default tseslint.config(
165
164
fixStyle : "separate-type-imports" ,
166
165
prefer : "type-imports" ,
167
166
} ,
168
- ] ,
169
-
167
+ ] , // different than love
170
168
"@typescript-eslint/prefer-destructuring" : [ "off" ] ,
171
-
172
169
"@typescript-eslint/explicit-member-accessibility" : [ "error" ] ,
173
-
174
170
"@typescript-eslint/explicit-module-boundary-types" : [ "error" ] ,
175
-
176
- "@typescript-eslint/member-ordering" : [
177
- "error" ,
178
- {
179
- default : [
180
- // Index signature
181
- "signature" ,
182
- // Fields
183
- "private-field" ,
184
- "public-field" ,
185
- "protected-field" ,
186
- // Constructors
187
- "public-constructor" ,
188
- "protected-constructor" ,
189
- "private-constructor" ,
190
- // Methods
191
- "public-method" ,
192
- "protected-method" ,
193
- "private-method" ,
194
- ] ,
195
- } ,
196
- ] ,
197
- "@typescript-eslint/naming-convention" : [
198
- "error" ,
199
- // {
200
- // format: ["camelCase", "PascalCase", "UPPER_CASE"],
201
- // leadingUnderscore: "allow",
202
- // selector: "variableLike",
203
- // trailingUnderscore: "allow",
204
- // },
205
- {
206
- format : [ "camelCase" , "PascalCase" , "UPPER_CASE" ] ,
207
- selector : "enumMember" ,
208
- } ,
209
- ] ,
210
- "@typescript-eslint/no-empty-object-type" : [ "error" ] ,
211
- "@typescript-eslint/no-explicit-any" : [ "error" , { fixToUnknown : true , ignoreRestArgs : false } ] ,
212
- "@typescript-eslint/no-extraneous-class" : [ "error" ] ,
171
+ "@typescript-eslint/member-ordering" : [ "error" ] ,
172
+ "@typescript-eslint/no-empty-object-type" : [ "error" ] , // stricter than love
173
+ "@typescript-eslint/no-explicit-any" : [ "error" , { fixToUnknown : true , ignoreRestArgs : false } ] , // stricter than love
174
+ "@typescript-eslint/no-extraneous-class" : [ "error" ] , // stricter than love
213
175
"@typescript-eslint/no-magic-numbers" : [ "off" ] ,
214
176
"@typescript-eslint/no-shadow" : [ "error" ] ,
215
177
"@typescript-eslint/no-unused-expressions" : [
@@ -220,7 +182,7 @@ export default tseslint.config(
220
182
allowTernary : false ,
221
183
enforceForJSX : false ,
222
184
} ,
223
- ] ,
185
+ ] , // stricter than love
224
186
"@typescript-eslint/no-unused-vars" : [
225
187
"error" ,
226
188
{
@@ -230,42 +192,24 @@ export default tseslint.config(
230
192
ignoreRestSiblings : false ,
231
193
vars : "all" ,
232
194
} ,
233
- ] ,
195
+ ] , // different than love
234
196
"@typescript-eslint/parameter-properties" : [ "error" ] ,
235
- "@typescript-eslint/prefer-for-of" : [ "error" ] ,
236
-
237
- "@typescript-eslint/prefer-regexp-exec" : [ "warn" ] ,
238
- "@typescript-eslint/prefer-string-starts-ends-with" : [ "error" ] ,
239
197
"@typescript-eslint/promise-function-async" : [ "off" ] ,
240
- "@typescript-eslint/require-await" : [ "error" ] ,
241
198
242
- "@typescript-eslint/unified-signatures " : [ "error" ] ,
199
+ "@typescript-eslint/return-await " : [ "error" , "in-try-catch "] ,
243
200
244
- "import/consistent-type-specifier-style " : [ "error" , "prefer-top-level "] ,
201
+ "@typescript-eslint/require-await " : [ "error" ] ,
245
202
246
- "n/handle-callback-err" : [ "error" , "^(err|error)$" ] ,
247
- "n/no-callback-literal" : [ "error" ] ,
248
- "n/no-deprecated-api" : [ "error" ] ,
249
- "n/no-exports-assign" : [ "error" ] ,
250
- "n/no-new-require" : [ "error" ] ,
251
- "n/no-path-concat" : [ "error" ] ,
252
- "n/process-exit-as-throw" : [ "error" ] ,
203
+ "import/consistent-type-specifier-style" : [ "error" , "prefer-top-level" ] ,
253
204
254
205
"perfectionist/sort-intersection-types" : [ "error" ] ,
255
206
"perfectionist/sort-union-types" : [ "error" ] ,
256
-
257
- "promise/param-names" : [ "error" ] ,
258
207
} ,
259
208
} ,
260
209
261
210
{
262
211
extends : [ tseslint . configs . disableTypeChecked ] ,
263
- files : [ "*.js" , "*.mjs" ] ,
264
- languageOptions : {
265
- globals : {
266
- ...globals . node ,
267
- } ,
268
- } ,
212
+ files : [ "*.mjs" ] ,
269
213
rules : { } ,
270
214
} ,
271
215
prettier ,
0 commit comments