1
+ import globals from "globals" ;
2
+ import babelParser from "@babel/eslint-parser" ;
3
+
4
+ export default [
5
+ {
6
+ languageOptions : {
7
+ globals : {
8
+ ...globals . browser ,
9
+ } ,
10
+
11
+ parser : babelParser ,
12
+ } ,
13
+
14
+ rules : {
15
+ // Possible Errors //
16
+ //-----------------//
17
+ "comma-dangle" : [ 2 , "never" ] ,
18
+ "no-cond-assign" : [ 2 , "except-parens" ] ,
19
+ "no-console" : 1 , // Allow for debugging
20
+ "no-constant-condition" : 2 ,
21
+ "no-control-regex" : 2 ,
22
+ "no-debugger" : 1 , // Allow for debugging
23
+ "no-dupe-args" : 2 ,
24
+ "no-dupe-keys" : 2 ,
25
+ "no-duplicate-case" : 2 ,
26
+ "no-empty" : 2 ,
27
+ "no-empty-character-class" : 2 ,
28
+ "no-ex-assign" : 2 ,
29
+ "no-extra-boolean-cast" : 2 ,
30
+ "no-extra-parens" : [ 2 , "functions" ] ,
31
+ "no-extra-semi" : 2 ,
32
+ "no-func-assign" : 2 ,
33
+ "no-inner-declarations" : 0 , // Stylistic... might consider disallowing in the future
34
+ "no-invalid-regexp" : 2 ,
35
+ "no-irregular-whitespace" : 2 ,
36
+ "no-negated-in-lhs" : 2 ,
37
+ "no-obj-calls" : 2 ,
38
+ "no-regex-spaces" : 2 ,
39
+ "no-sparse-arrays" : 0 ,
40
+ "no-unreachable" : 1 , // Optimizer and coverage will handle/highlight this and can be useful for debugging
41
+ "use-isnan" : 2 ,
42
+ "valid-jsdoc" : 0 ,
43
+ "valid-typeof" : 2 ,
44
+
45
+ // Best Practices //
46
+ //----------------//
47
+ "block-scoped-var" : 0 ,
48
+ complexity : 0 ,
49
+ "consistent-return" : 0 ,
50
+ curly : 2 ,
51
+ "default-case" : 1 ,
52
+
53
+ "dot-notation" : [ 2 , {
54
+ allowKeywords : false ,
55
+ } ] ,
56
+
57
+ eqeqeq : 0 ,
58
+ "guard-for-in" : 1 ,
59
+ "no-alert" : 2 ,
60
+ "no-caller" : 2 ,
61
+ "no-div-regex" : 1 ,
62
+ "no-else-return" : 0 ,
63
+ "no-eq-null" : 0 ,
64
+ "no-eval" : 2 ,
65
+ "no-extend-native" : 2 ,
66
+ "no-extra-bind" : 2 ,
67
+ "no-fallthrough" : 2 ,
68
+ "no-floating-decimal" : 2 ,
69
+ "no-implied-eval" : 2 ,
70
+ "no-iterator" : 2 ,
71
+ "no-labels" : 2 ,
72
+ "no-lone-blocks" : 2 ,
73
+ "no-loop-func" : 0 ,
74
+ "no-multi-spaces" : 2 ,
75
+ "no-multi-str" : 1 ,
76
+ "no-native-reassign" : 2 ,
77
+ "no-new" : 2 ,
78
+ "no-new-func" : 2 ,
79
+ "no-new-wrappers" : 2 ,
80
+ "no-octal" : 2 ,
81
+ "no-octal-escape" : 2 ,
82
+ "no-param-reassign" : 0 ,
83
+ "no-process-env" : 2 ,
84
+ "no-proto" : 2 ,
85
+ "no-redeclare" : 2 ,
86
+ "no-return-assign" : 2 ,
87
+ "no-script-url" : 2 ,
88
+ "no-self-compare" : 2 ,
89
+ "no-sequences" : 2 ,
90
+ "no-throw-literal" : 2 ,
91
+ "no-unused-expressions" : 2 ,
92
+ "no-void" : 0 ,
93
+ "no-warning-comments" : 1 ,
94
+ "no-with" : 2 ,
95
+ radix : 2 ,
96
+ "vars-on-top" : 0 ,
97
+ "wrap-iife" : 2 ,
98
+ yoda : 0 ,
99
+
100
+ // Strict //
101
+ //--------//
102
+ strict : 0 ,
103
+
104
+ // Variables //
105
+ //-----------//
106
+ "no-catch-shadow" : 2 ,
107
+ "no-delete-var" : 2 ,
108
+ "no-label-var" : 2 ,
109
+ "no-shadow" : 0 ,
110
+ "no-shadow-restricted-names" : 0 ,
111
+ "no-undef" : 2 ,
112
+ "no-undef-init" : 2 ,
113
+ "no-undefined" : 0 ,
114
+
115
+ "no-unused-vars" : [ 2 , {
116
+ vars : "all" ,
117
+ args : "after-used" ,
118
+ } ] ,
119
+
120
+ "no-use-before-define" : [ 2 , "nofunc" ] ,
121
+
122
+ // Node.js //
123
+ //---------//
124
+ "no-mixed-requires" : 0 , // Others left to environment defaults
125
+
126
+ // Stylistic //
127
+ //-----------//
128
+ indent : 0 ,
129
+ "brace-style" : [ 2 , "1tbs" , {
130
+ allowSingleLine : true ,
131
+ } ] ,
132
+
133
+ camelcase : 2 ,
134
+
135
+ "comma-spacing" : [ 2 , {
136
+ before : false ,
137
+ after : true ,
138
+ } ] ,
139
+
140
+ "comma-style" : [ 2 , "last" ] ,
141
+ "consistent-this" : [ 1 , "self" ] ,
142
+ "eol-last" : 2 ,
143
+ "func-names" : 0 ,
144
+ "func-style" : [ 2 , "declaration" ] ,
145
+
146
+ "key-spacing" : [ 2 , {
147
+ beforeColon : false ,
148
+ afterColon : true ,
149
+ } ] ,
150
+
151
+ "max-nested-callbacks" : 0 ,
152
+ "new-cap" : 2 ,
153
+ "new-parens" : 2 ,
154
+ "newline-after-var" : 0 ,
155
+ "no-array-constructor" : 2 ,
156
+ "no-continue" : 0 ,
157
+ "no-inline-comments" : 0 ,
158
+ "no-lonely-if" : 2 ,
159
+ "no-mixed-spaces-and-tabs" : 2 ,
160
+ "no-multiple-empty-lines" : 0 ,
161
+ "no-nested-ternary" : 1 ,
162
+ "no-new-object" : 2 ,
163
+ "no-spaced-func" : 2 ,
164
+ "no-ternary" : 0 ,
165
+ "no-trailing-spaces" : 2 ,
166
+ "no-underscore-dangle" : 0 ,
167
+ "one-var" : 0 ,
168
+ "operator-assignment" : 0 ,
169
+ "padded-blocks" : 0 ,
170
+
171
+ "quote-props" : [ 2 , "as-needed" , {
172
+ keywords : true ,
173
+ } ] ,
174
+
175
+ quotes : [ 2 , "single" , "avoid-escape" ] ,
176
+ semi : 2 ,
177
+
178
+ "semi-spacing" : [ 2 , {
179
+ before : false ,
180
+ after : true ,
181
+ } ] ,
182
+
183
+ "sort-vars" : 0 ,
184
+ "space-before-blocks" : [ 2 , "always" ] ,
185
+
186
+ "space-before-function-paren" : [ 2 , {
187
+ anonymous : "never" ,
188
+ named : "never" ,
189
+ } ] ,
190
+
191
+ "space-in-brackets" : 0 ,
192
+ "space-in-parens" : [ 2 , "never" ] ,
193
+ "space-infix-ops" : 2 ,
194
+ "space-unary-ops" : 2 ,
195
+ "spaced-comment" : [ 2 , "always" ] ,
196
+ "wrap-regex" : 1 ,
197
+ "no-var" : 2 ,
198
+ } ,
199
+ } ,
200
+ {
201
+ files : [ 'test/**/*.js' ] ,
202
+ languageOptions : {
203
+ globals : {
204
+ ...globals . node ,
205
+ ...globals . mocha ,
206
+ } ,
207
+ } ,
208
+ rules : {
209
+ "no-unused-expressions" : 0 , // Disabling for tests, for now.
210
+ "no-path-concat" : 0 ,
211
+ "no-console" : 0 ,
212
+ } ,
213
+ }
214
+ ] ;
0 commit comments