eslint-config-fe 1.4.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/less.js DELETED
@@ -1,994 +0,0 @@
1
-
2
-
3
- module.exports = {
4
- parser: '@babel/eslint-parser',
5
- parserOptions: {
6
- sourceType: 'module',
7
- ecmaFeatures: {
8
- jsx: true
9
- },
10
- requireConfigFile: false
11
- },
12
- plugins: [
13
- '@babel'
14
- ],
15
- env: {
16
- browser: true,
17
- node: true,
18
- es6: true
19
- },
20
- rules: {
21
- /**
22
- * 限制数组的括号使用一致的换行符
23
- *
24
- * https://eslint.org/docs/rules/array-bracket-newline
25
- */
26
- 'array-bracket-newline': ['warn', 'consistent'],
27
-
28
- /**
29
- * 限制在代码块中开括号后和闭括号前有空格
30
- *
31
- * https://eslint.org/docs/rules/block-spacing
32
- */
33
- 'block-spacing': ['warn', 'always'],
34
-
35
- /**
36
- * 避免在 case 或 default 子句中出现声明语句
37
- *
38
- * https://eslint.org/docs/rules/no-case-declarations
39
- */
40
- 'no-case-declarations': 'error',
41
-
42
- /**
43
- * 避免 case 语句缺失 break
44
- *
45
- * https://eslint.org/docs/rules/no-fallthrough
46
- */
47
- 'no-fallthrough': [
48
- 'error',
49
- { 'commentPattern': 'break[\\s\\w]*omitted' }
50
- ],
51
-
52
- /**
53
- * 避免使用空解构模式
54
- *
55
- * https://eslint.org/docs/rules/no-empty-pattern
56
- */
57
- 'no-empty-pattern': 'error',
58
-
59
- /**
60
- * 避免对原生对象或只读的全局对象进行赋值
61
- *
62
- * https://eslint.org/docs/rules/no-global-assign
63
- */
64
- 'no-global-assign': 'error',
65
-
66
- /**
67
- * 避免 Symbolnew 操作符和 new 一起使用
68
- *
69
- * https://eslint.org/docs/rules/no-new-symbol
70
- */
71
- 'no-new-symbol': 'error',
72
-
73
- /**
74
- * 避免正则表达式字面量中出现多个空格
75
- *
76
- * https://eslint.org/docs/rules/no-regex-spaces
77
- */
78
- 'no-regex-spaces': 'error',
79
-
80
- /**
81
- * 避免不必要的 return await
82
- *
83
- * https://eslint.org/docs/rules/no-return-await
84
- */
85
- 'no-return-await': 'error',
86
-
87
- /**
88
- * 避免给自身赋值
89
- *
90
- * https://eslint.org/docs/rules/no-self-assign
91
- */
92
- 'no-self-assign': 'error',
93
-
94
- /**
95
- * 避免使用逗号操作符
96
- *
97
- * https://eslint.org/docs/rules/no-sequences
98
- */
99
- 'no-sequences': 'error',
100
-
101
- /**
102
- * 避免使用令人困惑的多行表达式
103
- *
104
- * https://eslint.org/docs/rules/no-unexpected-multiline
105
- */
106
- 'no-unexpected-multiline': 'error',
107
-
108
- /**
109
- * 避免使用一成不变的循环条件
110
- *
111
- * https://eslint.org/docs/rules/no-unmodified-loop-condition
112
- */
113
- 'no-unmodified-loop-condition': 'warn',
114
-
115
- /**
116
- * 避免在 finally 语句块中出现控制流语句
117
- *
118
- * https://eslint.org/docs/rules/no-unsafe-finally
119
- */
120
- 'no-unsafe-finally': 'error',
121
-
122
- /**
123
- * 避免在对象中使用不必要的计算属性
124
- *
125
- * https://eslint.org/docs/rules/no-useless-computed-key
126
- */
127
- 'no-useless-computed-key': 'error',
128
-
129
- /**
130
- * 警告没有必要的字符拼接
131
- *
132
- * https://eslint.org/docs/rules/no-useless-concat
133
- */
134
- 'no-useless-concat': 'warn',
135
-
136
- /**
137
- * 避免不必要的转义
138
- *
139
- * https://eslint.org/docs/rules/no-useless-escape
140
- */
141
- 'no-useless-escape': 'error',
142
-
143
- /**
144
- * 避免属性前有空白
145
- *
146
- * https://eslint.org/docs/rules/no-whitespace-before-property
147
- */
148
- 'no-whitespace-before-property': 'error',
149
-
150
- /**
151
- * 避免使用不带 await 表达式的 async 函数
152
- *
153
- * https://eslint.org/docs/rules/require-await
154
- */
155
- 'require-await': 'warn',
156
-
157
- /**
158
- * 避免函数内没有yield的 generator 函数
159
- *
160
- * https://eslint.org/docs/rules/require-yield
161
- */
162
- 'require-yield': 'error',
163
-
164
- /**
165
- * 限制 case 语句的冒号右边有空格
166
- *
167
- * https://eslint.org/docs/rules/switch-colon-spacing
168
- */
169
- 'switch-colon-spacing': ['error', { before: false, after: true }],
170
-
171
- /**
172
- * 避免使用异步函数作为 Promise executor
173
- *
174
- * https://eslint.org/docs/rules/no-async-promise-executor
175
- */
176
- 'no-async-promise-executor': 'error',
177
-
178
- /**
179
- * 限制在 getter 属性中出现一个 return 语句
180
- *
181
- * https://eslint.org/docs/rules/getter-return
182
- */
183
- 'getter-return': 'error',
184
-
185
- /**
186
- * 避免在构造函数中返回值
187
- *
188
- * https://eslint.org/docs/rules/no-constructor-return
189
- */
190
- 'no-constructor-return': 'error',
191
-
192
- /**
193
- * 避免重复的 if-else-if 条件
194
- *
195
- * https://eslint.org/docs/rules/no-dupe-else-if
196
- */
197
- 'no-dupe-else-if': 'error',
198
-
199
- /**
200
- * 避免对 import 声明重新赋值
201
- *
202
- * https://eslint.org/docs/rules/no-import-assign
203
- */
204
- 'no-import-assign': 'error',
205
-
206
- /**
207
- * 避免在正则表达式中使用多余的反斜杠
208
- *
209
- * https://eslint.org/docs/rules/no-useless-backreference
210
- */
211
- 'no-useless-backreference': 'error',
212
-
213
- /**
214
- * 警告在非空文件末尾至少存在一行空行
215
- *
216
- * https://eslint.org/docs/rules/eol-last
217
- */
218
- 'eol-last': ['warn', 'always'],
219
-
220
- /**
221
- * 避免使用非字符串连接而使用模板字面量
222
- *
223
- * https://eslint.org/docs/rules/prefer-template
224
- */
225
- 'prefer-template': 'error',
226
-
227
- /**
228
- * 限制2个缩进
229
- *
230
- * https://eslint.org/docs/rules/no-mixed-spaces-and-tabs
231
- */
232
- 'indent': [
233
- 'error',
234
- 2,
235
- {
236
- SwitchCase: 1
237
- }
238
- ],
239
-
240
- /**
241
- * 限制 generator 函数星号后面有空格
242
- *
243
- * https://eslint.org/docs/rules/generator-star-spacing
244
- */
245
- 'generator-star-spacing': [
246
- 'error',
247
- {
248
- 'before': false,
249
- 'after': true
250
- }
251
- ],
252
-
253
- /**
254
- * 避免在括号内使用空格
255
- *
256
- * https://eslint.org/docs/rules/array-bracket-spacing
257
- */
258
- 'array-bracket-spacing': ['error', 'never'],
259
-
260
- /**
261
- * 限制箭头函数的参数被圆括号包围
262
- *
263
- * https://eslint.org/docs/rules/arrow-parens
264
- */
265
- 'arrow-parens': ['error', 'always'],
266
-
267
- /**
268
- * 限制使用 console.error、console.warn、console.info
269
- *
270
- * https://eslint.org/docs/rules/no-console
271
- */
272
- 'no-console': [
273
- 'warn',
274
- {
275
- allow: ['error', 'warn', 'info']
276
- }
277
- ],
278
-
279
- /**
280
- * 警告在条件中使用常量表达式
281
- *
282
- * https://eslint.org/docs/rules/no-constant-condition
283
- */
284
- 'no-constant-condition': 'warn',
285
-
286
- /**
287
- * 限制尾部没有逗号
288
- *
289
- * https://eslint.org/docs/rules/comma-dangle
290
- */
291
- 'comma-dangle': ['error', 'never'],
292
-
293
- /**
294
- * 避免使用 debugger
295
- *
296
- * https://eslint.org/docs/rules/no-debugger
297
- */
298
- 'no-debugger': 'error',
299
-
300
- /**
301
- * 警告在对象字面量中出现重复的键
302
- *
303
- * https://eslint.org/docs/rules/no-dupe-keys
304
- */
305
- 'no-dupe-keys': 'warn',
306
-
307
- /**
308
- * 避免正则表达式中出现空字符集
309
- *
310
- * https://eslint.org/docs/rules/no-empty-character-class
311
- */
312
- 'no-empty-character-class': 'error',
313
-
314
- /**
315
- * 避免对 catch 子句中的异常重新赋值
316
- *
317
- * https://eslint.org/docs/rules/no-ex-assign
318
- */
319
- 'no-ex-assign': 'error',
320
-
321
- /**
322
- * 警告出现不必要的布尔类型转换
323
- *
324
- * https://eslint.org/docs/rules/no-extra-boolean-cast
325
- */
326
- 'no-extra-boolean-cast': 'warn',
327
-
328
- /**
329
- * 警告对 function 声明重新赋值
330
- *
331
- * https://eslint.org/docs/rules/no-func-assign
332
- */
333
- 'no-func-assign': 'warn',
334
-
335
- /**
336
- * 警告在嵌套的语句块中出现变量或 function 声明
337
- *
338
- * https://eslint.org/docs/rules/no-inner-declarations
339
- */
340
- 'no-inner-declarations': 'warn',
341
-
342
- /**
343
- * 避免使用无效的正则表达式在 RegExp 构造函数中
344
- *
345
- * https://eslint.org/docs/rules/no-invalid-regexp
346
- */
347
- 'no-invalid-regexp': 'error',
348
-
349
- /**
350
- * 避免全局对象被当作函数调用
351
- *
352
- * https://eslint.org/docs/rules/no-obj-calls
353
- */
354
- 'no-obj-calls': 'error',
355
-
356
- /**
357
- * 避免使用稀疏数组
358
- *
359
- * https://eslint.org/docs/rules/no-sparse-arrays
360
- */
361
- 'no-sparse-arrays': 'error',
362
-
363
- /**
364
- * 避免在 return、throw、continue 和 break 语句后出现不被执行的代码
365
- *
366
- * https://eslint.org/docs/rules/no-unreachable
367
- */
368
- 'no-unreachable': 'error',
369
-
370
- /**
371
- * 避免循环中只有一次迭代
372
- *
373
- * https://eslint.org/docs/rules/no-unreachable-loop
374
- */
375
- 'no-unreachable-loop': 'error',
376
-
377
- /**
378
- * 限制使用 isNaN()检查 NaN
379
- *
380
- * https://eslint.org/docs/rules/use-isnan
381
- */
382
- 'use-isnan': 'error',
383
-
384
- /**
385
- * 限制使用 typeof 表达式与有效的字符串进行比较
386
- *
387
- * https://eslint.org/docs/rules/valid-typeof
388
- */
389
- 'valid-typeof': 'error',
390
-
391
- /**
392
- * 避免省略花括号当一个块只包含一条语句时
393
- *
394
- * https://eslint.org/docs/rules/curly
395
- */
396
- 'curly': ['error', 'all'],
397
-
398
- /**
399
- * 限制使用 === 和 !==
400
- *
401
- * https://eslint.org/docs/rules/eqeqeq
402
- */
403
- 'eqeqeq': ['error', 'allow-null'],
404
-
405
- /**
406
- * 警告 for-in 中没有判断是否是自身属性
407
- *
408
- * https://eslint.org/docs/rules/guard-for-in
409
- */
410
- 'guard-for-in': 'warn',
411
-
412
- /**
413
- * 警告在 else 前有 return
414
- *
415
- * https://eslint.org/docs/rules/no-else-return
416
- */
417
- 'no-else-return': 'warn',
418
-
419
- /**
420
- * 警告使用了非循环使用标签
421
- *
422
- * https://eslint.org/docs/rules/no-labels
423
- */
424
- 'no-labels': [
425
- 'warn',
426
- {
427
- 'allowLoop': true
428
- }
429
- ],
430
-
431
- /**
432
- * 警告使用了 eval()
433
- *
434
- * https://eslint.org/docs/rules/no-eval
435
- */
436
- 'no-eval': 'warn',
437
-
438
- /**
439
- * 避免扩展原生对象
440
- *
441
- * https://eslint.org/docs/rules/no-extend-native
442
- */
443
- 'no-extend-native': 'error',
444
-
445
- /**
446
- * 警告使用了不必要的函数绑定
447
- *
448
- * https://eslint.org/docs/rules/no-extra-bind
449
- */
450
- 'no-extra-bind': 'warn',
451
-
452
- /**
453
- * 警告使用了隐式的 eval()
454
- *
455
- * https://eslint.org/docs/rules/no-implied-eval
456
- */
457
- 'no-implied-eval': 'warn',
458
-
459
- /**
460
- * 避免使用废弃的迭代器属性 __iterator__
461
- *
462
- * https://eslint.org/docs/rules/no-iterator
463
- */
464
- 'no-iterator': 'error',
465
-
466
- /**
467
- * 警告使用了不规则的空白
468
- *
469
- * https://eslint.org/docs/rules/no-irregular-whitespace
470
- */
471
- 'no-irregular-whitespace': 'warn',
472
-
473
- /**
474
- * 警告使用了不必要的嵌套块
475
- *
476
- * https://eslint.org/docs/rules/no-lone-blocks
477
- */
478
- 'no-lone-blocks': 'warn',
479
-
480
- /**
481
- * 警告循环中存在函数
482
- *
483
- * https://eslint.org/docs/rules/no-loop-func
484
- */
485
- 'no-loop-func': 'warn',
486
-
487
- /**
488
- * 警告多行字符串 \
489
- *
490
- * https://eslint.org/docs/rules/no-multi-str
491
- */
492
- 'no-multi-str': 'warn',
493
-
494
- /**
495
- * 避免重新赋值原生对象
496
- *
497
- * https://eslint.org/docs/rules/no-native-reassign
498
- */
499
- 'no-native-reassign': 'error',
500
-
501
- /**
502
- * 避免使用原始包装实例
503
- *
504
- * https://eslint.org/docs/rules/no-new-wrappers
505
- */
506
- 'no-new-wrappers': 'error',
507
-
508
- /**
509
- * 警告使用了八进制字面量
510
- *
511
- * https://eslint.org/docs/rules/no-octal
512
- */
513
- 'no-octal': 'warn',
514
-
515
- /**
516
- * 警告在字符串字面量中使用八进制转义序列
517
- *
518
- * https://eslint.org/docs/rules/no-octal-escape
519
- */
520
- 'no-octal-escape': 'warn',
521
-
522
- /**
523
- * 避免使用 __proto__
524
- *
525
- * https://eslint.org/docs/rules/no-proto
526
- */
527
- 'no-proto': 'error',
528
-
529
- /**
530
- * 警告 var 重新声明变量
531
- *
532
- * https://eslint.org/docs/rules/no-redeclare
533
- */
534
- 'no-redeclare': 'warn',
535
-
536
- /**
537
- * 避免比较自身
538
- *
539
- * https://eslint.org/docs/rules/no-self-compare
540
- */
541
- 'no-self-compare': 'error',
542
-
543
- /**
544
- * 限制使用更简单结构的三元操作符
545
- *
546
- * https://eslint.org/docs/rules/no-unneeded-ternary
547
- */
548
- 'no-unneeded-ternary': 'error',
549
-
550
- /**
551
- * 警告使用了 with 语句
552
- *
553
- * https://eslint.org/docs/rules/no-with
554
- */
555
- 'no-with': 'warn',
556
-
557
- /**
558
- * 限制调用 parseInt() 函数时传入第二个参数
559
- *
560
- * https://eslint.org/docs/rules/no-with
561
- */
562
- 'radix': 'error',
563
-
564
- /**
565
- * 限制把立即执行的函数包裹起来再执行
566
- *
567
- * https://eslint.org/docs/rules/wrap-iife
568
- */
569
- 'wrap-iife': ['error', 'any'],
570
-
571
- /**
572
- * 避免使用 delete 删除变量
573
- *
574
- * https://eslint.org/docs/rules/no-delete-var
575
- */
576
- 'no-delete-var': 'warn',
577
-
578
- /**
579
- * 避免 function 定义中出现重复的参数名
580
- *
581
- * https://eslint.org/docs/rules/no-dupe-args
582
- */
583
- 'no-dupe-args': 'error',
584
-
585
- /**
586
- * 避免出现重复的 case 条件
587
- *
588
- * https://eslint.org/docs/rules/no-duplicate-case
589
- */
590
- 'no-duplicate-case': 'error',
591
-
592
- /**
593
- * 警告标签与变量同名
594
- *
595
- * https://eslint.org/docs/rules/no-label-var
596
- */
597
- 'no-label-var': 'warn',
598
-
599
- /**
600
- * 避免变量名或者函数名与全局对象属性、关键字相同
601
- *
602
- * https://eslint.org/docs/rules/no-shadow-restricted-names
603
- */
604
- 'no-shadow-restricted-names': 'error',
605
-
606
- /**
607
- * 避免使用未声明的变量
608
- *
609
- * https://eslint.org/docs/rules/no-undef
610
- */
611
- 'no-undef': 'error',
612
-
613
- /**
614
- * 警告定义变量的初始值为 undefined
615
- *
616
- * https://eslint.org/docs/rules/no-undef-init
617
- */
618
- 'no-undef-init': 'warn',
619
-
620
- /**
621
- * 警告当前作用域中声明的变量未使用,不检查传递的参数是否被使用
622
- *
623
- * https://eslint.org/docs/rules/no-unused-vars
624
- */
625
- 'no-unused-vars': [
626
- 'warn',
627
- {
628
- 'vars': 'local',
629
- 'args': 'none'
630
- }
631
- ],
632
-
633
- /**
634
- * 避免非函数在定义前使用
635
- *
636
- * https://eslint.org/docs/rules/no-use-before-define
637
- */
638
- 'no-use-before-define': ['error', 'nofunc'],
639
-
640
- /**
641
- * 限制大括号风格,if-else中的else语句,连同catch 和 finally,都必须在右括号后另起一行
642
- *
643
- * https://eslint.org/docs/rules/brace-style
644
- */
645
- 'brace-style': ['warn', 'stroustrup'],
646
-
647
- /**
648
- * 限制在逗号后加空格
649
- * 默认选项 { "before": false, "after": true }
650
- *
651
- * https://eslint.org/docs/rules/comma-spacing
652
- */
653
- 'comma-spacing': 'error',
654
-
655
- /**
656
- * 限制逗号风格,要求逗号放在数组元素、对象属性或变量声明之后,且在同一行
657
- *
658
- * https://eslint.org/docs/rules/comma-style
659
- */
660
- 'comma-style': ['error', 'last'],
661
-
662
- /**
663
- * 警告使用了无参构造函数时未带括号
664
- *
665
- * https://eslint.org/docs/rules/new-parens
666
- */
667
- 'new-parens': 'warn',
668
-
669
- /**
670
- * 避免使用 Array 构造函数
671
- *
672
- * https://eslint.org/docs/rules/no-array-constructor
673
- */
674
- 'no-array-constructor': 'error',
675
-
676
- /**
677
- * 避免一行出现多个空格,除了对象属性定义、二元表达式、定义变量对齐
678
- *
679
- * https://eslint.org/docs/rules/no-multi-spaces
680
- */
681
- 'no-multi-spaces': [
682
- 'error',
683
- {
684
- 'exceptions': {
685
- 'Property': true,
686
- 'BinaryExpression': true,
687
- 'VariableDeclarator': true
688
- }
689
- }
690
- ],
691
-
692
- /**
693
- * 避免使用 Object 构造函数
694
- *
695
- * https://eslint.org/docs/rules/no-new-object
696
- */
697
- 'no-new-object': 'error',
698
-
699
- /**
700
- * 避免函数标识符和其调用之间出现空格
701
- *
702
- * https://eslint.org/docs/rules/func-call-spacing
703
- */
704
- 'func-call-spacing': 'error',
705
-
706
- /**
707
- * 避免行尾出现空白
708
- *
709
- * https://eslint.org/docs/rules/no-trailing-spaces
710
- */
711
- 'no-trailing-spaces': 'error',
712
-
713
- /**
714
- * 避免 空格 和 tab 混合缩进
715
- *
716
- * https://eslint.org/docs/rules/no-mixed-spaces-and-tabs
717
- */
718
- 'no-mixed-spaces-and-tabs': 'error',
719
-
720
- /**
721
- * 限制函数中的变量分开声明
722
- *
723
- * https://eslint.org/docs/rules/one-var
724
- */
725
- 'one-var': ['error', 'never'],
726
-
727
- /**
728
- * 限制换行符在操作符之前
729
- *
730
- * https://eslint.org/docs/rules/operator-linebreak
731
- */
732
- 'operator-linebreak': ['error', 'before'],
733
-
734
- /**
735
- * 限制使用单引号除了字符串中包含了一个其它的引号
736
- *
737
- * https://eslint.org/docs/rules/quotes
738
- */
739
- 'quotes': [
740
- 'error',
741
- 'single',
742
- { 'avoidEscape': true }
743
- ],
744
-
745
- /**
746
- * 限制分号后面有空格
747
- * 默认选项为 {"before": false, "after": true}
748
- *
749
- * https://eslint.org/docs/rules/semi-spacing
750
- */
751
- 'semi-spacing': 'error',
752
-
753
- /**
754
- * 限制关键字前后出现空格
755
- *
756
- * https://eslint.org/docs/rules/keyword-spacing
757
- */
758
- 'keyword-spacing': [
759
- 'error',
760
- {
761
- 'before': true,
762
- 'after': true
763
- }
764
- ],
765
-
766
- /**
767
- * 限制对象字面量的键后面无空格,值前面有空格
768
- * 默认选项 { "beforeColon": false, "afterColon": true, "mode": "strict" }
769
- *
770
- * https://eslint.org/docs/rules/keyword-spacing
771
- */
772
- 'key-spacing': 'error',
773
-
774
- /**
775
- * 限制函数圆括号之前有一个空格除了具名函数
776
- *
777
- * https://eslint.org/docs/rules/space-before-function-paren
778
- */
779
- 'space-before-function-paren': [
780
- 'error',
781
- {
782
- 'anonymous': 'always',
783
- 'named': 'never',
784
- 'asyncArrow': 'always'
785
- }
786
- ],
787
-
788
- /**
789
- * 限制语句块之前有空格
790
- *
791
- * https://eslint.org/docs/rules/space-before-blocks
792
- */
793
- 'space-before-blocks': ['error', 'always'],
794
-
795
- /**
796
- * 限制计算属性中无空格
797
- *
798
- * https://eslint.org/docs/rules/computed-property-spacing
799
- */
800
- 'computed-property-spacing': ['error', 'never'],
801
-
802
- /**
803
- * 限制圆括号内无空格
804
- *
805
- * https://eslint.org/docs/rules/space-in-parens
806
- */
807
- 'space-in-parens': ['error', 'never'],
808
-
809
- /**
810
- * 限制单词类一元操作符之前或之后有空格,限制一元操作符之前或之后无空格
811
- * 默认选项 {"words": true, "nonwords": false}
812
- *
813
- * https://eslint.org/docs/rules/space-unary-ops
814
- */
815
- 'space-unary-ops': 'warn',
816
-
817
- /**
818
- * 限制注释前至少要有一个空格,除了固定的几个字符
819
- *
820
- * https://eslint.org/docs/rules/spaced-comment
821
- */
822
- 'spaced-comment': [
823
- 'error',
824
- 'always',
825
- {
826
- 'exceptions': [
827
- '-',
828
- '+',
829
- '\'',
830
- '#'
831
- ],
832
- 'block': {
833
- 'balanced': true
834
- }
835
- }
836
- ],
837
-
838
- /**
839
- * 限制行的最大长度
840
- *
841
- * https://eslint.org/docs/rules/max-len
842
- */
843
- 'max-len': [
844
- 'error',
845
- {
846
- 'code': 120,
847
- 'tabWidth': 4,
848
- 'ignorePattern': 'data:image/',
849
- 'ignoreUrls': true,
850
- 'ignoreRegExpLiterals': true
851
- }
852
- ],
853
-
854
- /**
855
- * 限制中缀操作符周围有空格
856
- *
857
- * https://eslint.org/docs/rules/space-infix-ops
858
- */
859
- 'space-infix-ops': 'error',
860
-
861
- /**
862
- * 限制使用点号访问属性,部分关键字除外
863
- * 默认选项 { "allowKeywords": true }
864
- *
865
- * https://eslint.org/docs/rules/dot-notation
866
- */
867
- 'dot-notation': [
868
- 'error',
869
- {
870
- 'allowPattern': '^catch$'
871
- }
872
- ],
873
-
874
- /**
875
- * 限制箭头函数的箭头之前和之后有空格
876
- * 默认选项 { "before": true, "after": true }
877
- *
878
- * https://eslint.org/docs/rules/arrow-spacing
879
- */
880
- 'arrow-spacing': 'error',
881
-
882
- /**
883
- * 限制派生类中的构造函数必须调用 super()
884
- *
885
- * https://eslint.org/docs/rules/constructor-super
886
- */
887
- 'constructor-super': 'error',
888
-
889
- /**
890
- * 避免可能与比较操作符相混淆的地方使用箭头函数
891
- * 默认选项 { "allowParens": true }
892
- *
893
- * https://eslint.org/docs/rules/no-confusing-arrow
894
- */
895
- 'no-confusing-arrow': 'error',
896
-
897
- /**
898
- * 警告修改类声明的变量
899
- *
900
- * https://eslint.org/docs/rules/no-class-assign
901
- */
902
- 'no-class-assign': 'warn',
903
-
904
- /**
905
- * 避免修改 const 声明的变量
906
- *
907
- * https://eslint.org/docs/rules/no-const-assign
908
- */
909
- 'no-const-assign': 'error',
910
-
911
- /**
912
- * 警告类成员中重复的名称
913
- *
914
- * https://eslint.org/docs/rules/no-dupe-class-members
915
- */
916
- 'no-dupe-class-members': 'warn',
917
-
918
- /**
919
- * 警告在构造函数中调用super()之前使用this或super
920
- *
921
- * https://eslint.org/docs/rules/no-this-before-super
922
- */
923
- 'no-this-before-super': 'warn',
924
-
925
- /**
926
- * 警告使用了 let 或 const 非 var
927
- *
928
- * https://eslint.org/docs/rules/no-var
929
- */
930
- 'no-var': 'warn',
931
-
932
- /**
933
- * 警告重复导入
934
- *
935
- * https://eslint.org/docs/rules/no-duplicate-imports
936
- */
937
- 'no-duplicate-imports': 'warn',
938
-
939
- /**
940
- * 限制一行只有一条语句
941
- * 默认选项 { "max": 1 }
942
- *
943
- * https://eslint.org/docs/rules/max-statements-per-line
944
- */
945
- 'max-statements-per-line': 'error',
946
-
947
- /**
948
- * 警告使用了不必要的构造函数
949
- *
950
- * https://eslint.org/docs/rules/no-useless-constructor
951
- */
952
- 'no-useless-constructor': 'warn',
953
-
954
-
955
- /**
956
- * 限制构造函数首字母大写
957
- *
958
- * https://eslint.org/docs/rules/new-cap
959
- */
960
- '@babel/new-cap': [
961
- 'error',
962
- {
963
- 'capIsNewExceptions': [
964
- 'Vue',
965
- 'React'
966
- ]
967
- }
968
- ],
969
-
970
- /**
971
- * 限制在花括号中使用一致的空格
972
- *
973
- * https://eslint.org/docs/rules/object-curly-spacing
974
- */
975
- '@babel/object-curly-spacing': ['error', 'always'],
976
-
977
- /**
978
- * 限制语句末尾使用分号
979
- * 默认选项为 'always'
980
- *
981
- * https://eslint.org/docs/rules/semi
982
- */
983
- '@babel/semi': 'error'
984
- },
985
- overrides: [
986
- {
987
- files: ['**/*.test.js', '**/*.spec.js'],
988
- env: {
989
- es6: true,
990
- jest: true
991
- }
992
- }
993
- ]
994
- };