1
- /**
2
- * @author Toru Nagashima
3
- * See LICENSE file in root directory for full license.
4
- */
5
1
"use strict"
6
2
7
3
const { Linter } = require ( "eslint" )
8
4
const semver = require ( "semver" )
9
5
10
6
const isESLint7OrHigher = semver . gte ( Linter . version , "7.0.0" )
11
7
const isESLint8OrHigher = semver . gte ( Linter . version , "8.0.0" )
8
+ const isESLint850OrHigher = semver . gte ( Linter . version , "8.50.0" )
9
+ const isESLint853OrHigher = semver . gte ( Linter . version , "8.53.0" )
12
10
13
11
/** @type {import('eslint').Linter.Config } */
14
12
module . exports = {
@@ -43,10 +41,7 @@ module.exports = {
43
41
"getter-return" : "error" ,
44
42
"grouped-accessor-pairs" : "error" ,
45
43
"init-declarations" : "error" ,
46
- "linebreak-style" : [ "error" , "unix" ] ,
47
- "lines-between-class-members" : "error" ,
48
44
...( isESLint8OrHigher ? { "logical-assignment-operators" : "off" } : { } ) , // TODO: enable once we drop ESLint v7 support
49
- "max-statements-per-line" : [ "error" , { max : 1 } ] ,
50
45
"multiline-comment-style" : [ "error" , "separate-lines" ] ,
51
46
"new-cap" : "error" ,
52
47
"no-alert" : "error" ,
@@ -107,21 +102,14 @@ module.exports = {
107
102
"no-loop-func" : "error" ,
108
103
...( isESLint7OrHigher ? { "no-loss-of-precision" : "off" } : { } ) , // TODO: enable once we drop ESLint v6 support
109
104
"no-misleading-character-class" : "error" ,
110
- "no-mixed-operators" : [
111
- "error" ,
112
- {
113
- groups : [
114
- [ "&" , "|" , "^" , "~" , "<<" , ">>" , ">>>" ] ,
115
- [ "&&" , "||" ] ,
116
- ] ,
117
- } ,
118
- ] ,
119
105
"no-new" : "error" ,
120
106
...( isESLint8OrHigher ? { "no-new-native-nonconstructor" : "off" } : { } ) , // TODO: enable once we drop ESLint v7 support
121
- "no-new-object" : "error" ,
122
107
"no-new-require" : "error" ,
123
108
"no-new-wrappers" : "error" ,
124
109
...( isESLint7OrHigher ? { "no-nonoctal-decimal-escape" : "off" } : { } ) , // TODO: enable once we drop ESLint v6 support
110
+ ...( isESLint850OrHigher
111
+ ? { "no-object-constructor" : "error" }
112
+ : { "no-new-object" : "error" } ) , // TODO: remove once we drop ESLint v8.50 support
125
113
"no-obj-calls" : "error" ,
126
114
"no-octal" : "error" ,
127
115
"no-octal-escape" : "error" ,
@@ -152,7 +140,6 @@ module.exports = {
152
140
"no-shadow" : [ "error" , { builtinGlobals : true } ] ,
153
141
"no-shadow-restricted-names" : "error" ,
154
142
"no-sparse-arrays" : "error" ,
155
- "no-tabs" : "error" ,
156
143
"no-throw-literal" : "error" ,
157
144
"no-undef" : [ "error" , { typeof : true } ] ,
158
145
"no-unexpected-multiline" : "error" ,
@@ -194,48 +181,13 @@ module.exports = {
194
181
uninitialized : "always" ,
195
182
} ,
196
183
] ,
197
- "padding-line-between-statements" : [
198
- "error" ,
199
- { blankLine : "always" , next : "*" , prev : "directive" } ,
200
- { blankLine : "always" , next : "function" , prev : "*" } ,
201
- { blankLine : "always" , next : "*" , prev : "function" } ,
202
- ] ,
203
184
"prefer-exponentiation-operator" : "error" ,
204
185
...( isESLint8OrHigher ? { "prefer-object-has-own" : "off" } : { } ) , // TODO: enable once we drop ESLint v7 support
205
186
"prefer-promise-reject-errors" : "error" ,
206
187
"prefer-regex-literals" : "error" ,
207
- quotes : [ "error" , "double" , { avoidEscape : true } ] ,
208
188
radix : "error" ,
209
189
"require-atomic-updates" : "error" ,
210
190
"require-await" : "error" ,
211
- "spaced-comment" : [
212
- "error" ,
213
- "always" ,
214
- {
215
- block : {
216
- balanced : true ,
217
- markers : [
218
- "eslint" ,
219
- "eslint-env" ,
220
- "eslint-disable" ,
221
- "eslint-enable" ,
222
- "exported" ,
223
- "globals" ,
224
- "istanbul" ,
225
- ] ,
226
- } ,
227
- line : {
228
- exceptions : [ "-" , "=" ] ,
229
- markers : [
230
- "eslint-disable-line" ,
231
- "eslint-disable-next-line" ,
232
- "istanbul" ,
233
- "TODO:" ,
234
- "FIXME:" ,
235
- ] ,
236
- } ,
237
- } ,
238
- ] ,
239
191
strict : [ "error" , "global" ] ,
240
192
"use-isnan" : [
241
193
"error" ,
@@ -250,64 +202,77 @@ module.exports = {
250
202
"max-params" : [ "warn" , { max : 8 } ] ,
251
203
"no-console" : [ "warn" , { allow : [ "assert" , "error" ] } ] ,
252
204
253
- // Disabled rules as favor of Prettier.
254
- "array-bracket-newline" : "off" ,
255
- "array-bracket-spacing" : "off" ,
256
- "array-element-newline" : "off" ,
257
- "arrow-parens" : "off" ,
258
- "arrow-spacing" : "off" ,
259
- "block-spacing" : "off" ,
260
- "brace-style" : "off" ,
261
- "comma-dangle" : "off" ,
262
- "comma-spacing" : "off" ,
263
- "comma-style" : "off" ,
264
- "computed-property-spacing" : "off" ,
265
- "dot-location" : "off" ,
266
- "eol-last" : "off" ,
267
- "func-call-spacing" : "off" ,
268
- "function-call-argument-newline" : "off" ,
269
- "function-paren-newline" : "off" ,
270
- "generator-star-spacing" : "off" ,
271
- "implicit-arrow-linebreak" : "off" ,
272
- indent : "off" ,
273
- "jsx-quotes" : "off" ,
274
- "key-spacing" : "off" ,
275
- "keyword-spacing" : "off" ,
276
- "multiline-ternary" : "off" ,
277
- "new-parens" : "off" ,
278
- "newline-per-chained-call" : "off" ,
279
- "no-extra-parens" : "off" ,
280
- "no-extra-semi" : "off" ,
281
- "no-floating-decimal" : "off" ,
282
- "no-mixed-spaces-and-tabs" : "off" ,
283
- "no-multi-spaces" : "off" ,
284
- "no-multiple-empty-lines" : "off" ,
285
- "no-trailing-spaces" : "off" ,
286
- "no-whitespace-before-property" : "off" ,
287
- "nonblock-statement-body-position" : "off" ,
288
- "object-curly-newline" : "off" ,
289
- "object-curly-spacing" : "off" ,
290
- "object-property-newline" : "off" ,
291
- "one-var-declaration-per-line" : "off" ,
292
- "operator-linebreak" : "off" ,
293
- "padded-blocks" : "off" ,
294
- "quote-props" : "off" ,
295
- "rest-spread-spacing" : "off" ,
296
- semi : "off" ,
297
- "semi-spacing" : "off" ,
298
- "semi-style" : "off" ,
299
- "space-before-blocks" : "off" ,
300
- "space-before-function-paren" : "off" ,
301
- "space-in-parens" : "off" ,
302
- "space-infix-ops" : "off" ,
303
- "space-unary-ops" : "off" ,
304
- "switch-colon-spacing" : "off" ,
305
- "template-curly-spacing" : "off" ,
306
- "template-tag-spacing" : "off" ,
307
- "unicode-bom" : "off" ,
308
- "wrap-iife" : "off" ,
309
- "wrap-regex" : "off" ,
310
- "yield-star-spacing" : "off" ,
205
+ ...( isESLint853OrHigher
206
+ ? { }
207
+ : {
208
+ "array-bracket-newline" : "off" ,
209
+ "array-bracket-spacing" : "off" ,
210
+ "array-element-newline" : "off" ,
211
+ "arrow-parens" : "off" ,
212
+ "arrow-spacing" : "off" ,
213
+ "block-spacing" : "off" ,
214
+ "brace-style" : "off" ,
215
+ "comma-dangle" : "off" ,
216
+ "comma-spacing" : "off" ,
217
+ "comma-style" : "off" ,
218
+ "computed-property-spacing" : "off" ,
219
+ "dot-location" : "off" ,
220
+ "eol-last" : "off" ,
221
+ "func-call-spacing" : "off" ,
222
+ "function-call-argument-newline" : "off" ,
223
+ "function-paren-newline" : "off" ,
224
+ "generator-star-spacing" : "off" ,
225
+ "implicit-arrow-linebreak" : "off" ,
226
+ indent : "off" ,
227
+ "jsx-quotes" : "off" ,
228
+ "key-spacing" : "off" ,
229
+ "keyword-spacing" : "off" ,
230
+ "linebreak-style" : "off" ,
231
+ "lines-around-comment" : "off" ,
232
+ "lines-between-class-members" : "off" ,
233
+ "max-len" : "off" ,
234
+ "max-statements-per-line" : "off" ,
235
+ "multiline-ternary" : "off" ,
236
+ "new-parens" : "off" ,
237
+ "newline-per-chained-call" : "off" ,
238
+ "no-confusing-arrow" : "off" ,
239
+ "no-extra-parens" : "off" ,
240
+ "no-extra-semi" : "off" ,
241
+ "no-floating-decimal" : "off" ,
242
+ "no-mixed-operators" : "off" ,
243
+ "no-mixed-spaces-and-tabs" : "off" ,
244
+ "no-multi-spaces" : "off" ,
245
+ "no-multiple-empty-lines" : "off" ,
246
+ "no-tabs" : "off" ,
247
+ "no-trailing-spaces" : "off" ,
248
+ "no-whitespace-before-property" : "off" ,
249
+ "nonblock-statement-body-position" : "off" ,
250
+ "object-curly-newline" : "off" ,
251
+ "object-curly-spacing" : "off" ,
252
+ "object-property-newline" : "off" ,
253
+ "one-var-declaration-per-line" : "off" ,
254
+ "operator-linebreak" : "off" ,
255
+ "padded-blocks" : "off" ,
256
+ "padding-line-between-statements" : "off" ,
257
+ "quote-props" : "off" ,
258
+ quotes : "off" ,
259
+ "rest-spread-spacing" : "off" ,
260
+ semi : "off" ,
261
+ "semi-spacing" : "off" ,
262
+ "semi-style" : "off" ,
263
+ "space-before-blocks" : "off" ,
264
+ "space-before-function-paren" : "off" ,
265
+ "space-in-parens" : "off" ,
266
+ "space-infix-ops" : "off" ,
267
+ "space-unary-ops" : "off" ,
268
+ "spaced-comment" : "off" ,
269
+ "switch-colon-spacing" : "off" ,
270
+ "template-curly-spacing" : "off" ,
271
+ "template-tag-spacing" : "off" ,
272
+ "wrap-iife" : "off" ,
273
+ "wrap-regex" : "off" ,
274
+ "yield-star-spacing" : "off" ,
275
+ } ) , // TODO: remove once we drop ESLint v8.53 support
311
276
312
277
// Disabled rules
313
278
"arrow-body-style" : "off" ,
@@ -327,18 +292,15 @@ module.exports = {
327
292
"id-length" : "off" ,
328
293
"id-match" : "off" ,
329
294
"line-comment-position" : "off" ,
330
- "lines-around-comment" : "off" ,
331
295
"max-classes-per-file" : "off" ,
332
296
"max-depth" : "off" ,
333
- "max-len" : "off" ,
334
297
"max-lines" : "off" ,
335
298
"max-lines-per-function" : "off" ,
336
299
"max-statements" : "off" ,
337
300
"no-await-in-loop" : "off" ,
338
301
"no-bitwise" : "off" ,
339
302
"no-buffer-constructor" : "off" ,
340
303
"no-class-assign" : "off" ,
341
- "no-confusing-arrow" : "off" ,
342
304
"no-const-assign" : "off" ,
343
305
"no-continue" : "off" ,
344
306
"no-dupe-class-members" : "off" ,
@@ -391,6 +353,7 @@ module.exports = {
391
353
"sort-keys" : "off" ,
392
354
"sort-vars" : "off" ,
393
355
"symbol-description" : "off" ,
356
+ "unicode-bom" : "off" ,
394
357
"vars-on-top" : "off" ,
395
358
396
359
//
0 commit comments