@picovoice/eagle-web 2.0.0 → 3.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/.eslintrc.js CHANGED
@@ -1,469 +1,469 @@
1
- // Rules reference: http://eslint.org/docs/rules/
2
- module.exports = {
3
- env: {
4
- browser: true,
5
- node: true,
6
- es6: true,
7
- mocha: true
8
- },
9
-
10
- parser: '@typescript-eslint/parser',
11
- parserOptions: {
12
- ecmaVersion: 2018
13
- },
14
-
15
- ignorePatterns: ['**/*.js', 'node_modules', 'dist'],
16
- overrides: [
17
- {
18
- files: ['src/**/*.ts'],
19
- extends: ['plugin:@typescript-eslint/recommended'],
20
- rules: {
21
- '@typescript-eslint/no-parameter-properties': 2,
22
- '@typescript-eslint/no-explicit-any': 0,
23
- '@typescript-eslint/no-var-requires': 2,
24
- '@typescript-eslint/no-non-null-assertion': 2,
25
- '@typescript-eslint/no-use-before-define': 2,
26
- '@typescript-eslint/camelcase': 0,
27
- '@typescript-eslint/no-empty-interface': 2,
28
- '@typescript-eslint/explicit-function-return-type': 2,
29
- '@typescript-eslint/ban-ts-comment': 0,
30
- "@typescript-eslint/no-shadow": 2,
31
- '@typescript-eslint/no-empty-function': [2, { "allow": ["constructors"] }],
32
- '@typescript-eslint/no-inferrable-types': [
33
- 2,
34
- {
35
- ignoreParameters: true,
36
- ignoreProperties: true
37
- }
38
- ]
39
- }
40
- },
41
- {
42
- files: ['test/**/*.ts', 'cypress/**/*.ts'],
43
- extends: ['plugin:cypress/recommended'],
44
- rules: {
45
- 'no-unused-expressions': 0,
46
- 'no-unused-vars': 0
47
- }
48
- }
49
- ],
50
-
51
- rules: {
52
- //=========================================================================
53
- //==================== Possible Errors ====================================
54
- //=========================================================================
55
-
56
- // disallow trailing commas in object literals
57
- 'comma-dangle': [0, 'always-multiline'], //TODO: need discussion
58
- // disallow assignment in conditional expressions
59
- 'no-cond-assign': [2, 'always'],
60
- // disallow use of console
61
- 'no-console': 1,
62
- // disallow use of constant expressions in conditions
63
- 'no-constant-condition': [2, { checkLoops: false }],
64
- // disallow control characters in regular expressions
65
- 'no-control-regex': 2,
66
- // disallow use of debugger
67
- 'no-debugger': 2,
68
- // disallow duplicate arguments in functions
69
- 'no-dupe-args': 2,
70
- // disallow duplicate keys when creating object literals
71
- 'no-dupe-keys': 2,
72
- // disallow a duplicate case label.
73
- 'no-duplicate-case': 2,
74
- // disallow the use of empty character classes in regular expressions
75
- 'no-empty-character-class': 2,
76
- // disallow empty statements
77
- 'no-empty': 2,
78
- // disallow assigning to the exception in a catch block
79
- 'no-ex-assign': 2,
80
- // disallow double-negation boolean casts in a boolean context
81
- 'no-extra-boolean-cast': 2,
82
- // disallow unnecessary parentheses
83
- 'no-extra-parens': [2, 'functions'],
84
- // disallow unnecessary semicolons
85
- 'no-extra-semi': 2,
86
- // disallow overwriting functions written as function declarations
87
- 'no-func-assign': 2,
88
- // disallow function or variable declarations in nested blocks
89
- 'no-inner-declarations': 2,
90
- // disallow invalid regular expression strings in the RegExp constructor
91
- 'no-invalid-regexp': 2,
92
- // disallow irregular whitespace outside of strings and comments
93
- 'no-irregular-whitespace': 2,
94
- // disallow negation of the left operand of an in expression
95
- 'no-negated-in-lhs': 2,
96
- // disallow the use of object properties of the global object (Math and JSON) as functions
97
- 'no-obj-calls': 2,
98
- // disallow multiple spaces in a regular expression literal
99
- 'no-regex-spaces': 2,
100
- // disallow sparse arrays
101
- 'no-sparse-arrays': 2,
102
- // Avoid code that looks like two expressions but is actually one
103
- 'no-unexpected-multiline': 2,
104
- // disallow unreachable statements after a return, throw, continue, or break statement
105
- 'no-unreachable': 2,
106
- // disallow comparisons with the value NaN
107
- 'use-isnan': 2,
108
- // ensure JSDoc comments are valid
109
- 'valid-jsdoc': [
110
- 0,
111
- {
112
- requireReturn: false,
113
- requireReturnDescription: false
114
- }
115
- ],
116
- // ensure that the results of typeof are compared against a valid string
117
- 'valid-typeof': 2,
118
-
119
- //=========================================================================
120
- //==================== Best Practices =====================================
121
- //=========================================================================
122
- // Enforces getter/setter pairs in objects
123
- 'accessor-pairs': 2,
124
- // treat var statements as if they were block scoped
125
- 'block-scoped-var': 2,
126
- // specify the maximum cyclomatic complexity allowed in a program
127
- complexity: [0, 11],
128
- // require return statements to either always or never specify values
129
- 'consistent-return': 2,
130
- // specify curly brace conventions for all control statements
131
- curly: [2, 'multi-line'],
132
- // require default case in switch statements
133
- 'default-case': 2,
134
- // encourages use of dot notation whenever possible
135
- 'dot-notation': [2, { allowKeywords: true }],
136
- // enforces consistent newlines before or after dots
137
- 'dot-location': [2, 'property'],
138
- // require the use of === and !==
139
- eqeqeq: 2,
140
- // make sure for-in loops have an if statement
141
- 'guard-for-in': 2,
142
- // disallow the use of alert, confirm, and prompt
143
- 'no-alert': 2,
144
- // disallow use of arguments.caller or arguments.callee
145
- 'no-caller': 2,
146
- // disallow lexical declarations in case clauses
147
- 'no-case-declarations': 2,
148
- // disallow division operators explicitly at beginning of regular expression
149
- 'no-div-regex': 2,
150
- // disallow else after a return in an if
151
- 'no-else-return': 0,
152
- // disallow use of empty destructuring patterns
153
- 'no-empty-pattern': 2,
154
- // disallow comparisons to null without a type-checking operator
155
- 'no-eq-null': 2,
156
- // disallow use of eval()
157
- 'no-eval': 2,
158
- // disallow adding to native types
159
- 'no-extend-native': 2,
160
- // disallow unnecessary function binding
161
- 'no-extra-bind': 2,
162
- // disallow fallthrough of case statements
163
- 'no-fallthrough': 2,
164
- // disallow the use of leading or trailing decimal points in numeric literals
165
- 'no-floating-decimal': 2,
166
- // disallow the type conversions with shorter notations
167
- 'no-implicit-coercion': 2,
168
- // disallow use of eval()-like methods
169
- 'no-implied-eval': 2,
170
- // disallow this keywords outside of classes or class-like objects
171
- 'no-invalid-this': 0,
172
- // disallow usage of __iterator__ property
173
- 'no-iterator': 2,
174
- // disallow use of labeled statements
175
- 'no-labels': 2,
176
- // disallow unnecessary nested blocks
177
- 'no-lone-blocks': 2,
178
- // disallow creation of functions within loops
179
- 'no-loop-func': 2,
180
- // disallow the use of magic numbers
181
- 'no-magic-numbers': 0, //TODO: need discussion
182
- // disallow use of multiple spaces
183
- 'no-multi-spaces': 2,
184
- // disallow use of multiline strings
185
- 'no-multi-str': 2,
186
- // disallow reassignments of native objects
187
- 'no-native-reassign': 2,
188
- // disallow use of new operator for Function object
189
- 'no-new-func': 2,
190
- // disallows creating new instances of String,Number, and Boolean
191
- 'no-new-wrappers': 2,
192
- // disallow use of new operator when not part of the assignment or comparison
193
- 'no-new': 2,
194
- // disallow use of octal escape sequences in string literals, such as
195
- // var foo = "Copyright \251";
196
- 'no-octal-escape': 2,
197
- // disallow use of (old style) octal literals
198
- 'no-octal': 2,
199
- // disallow reassignment of function parameters
200
- 'no-param-reassign': 2,
201
- // disallow use of process.env
202
- 'no-process-env': 2,
203
- // disallow usage of __proto__ property
204
- 'no-proto': 2,
205
- // disallow declaring the same variable more then once
206
- 'no-redeclare': 2,
207
- // disallow use of assignment in return statement
208
- 'no-return-assign': 2,
209
- // disallow use of `javascript:` urls.
210
- 'no-script-url': 2,
211
- // disallow comparisons where both sides are exactly the same
212
- 'no-self-compare': 2,
213
- // disallow use of comma operator
214
- 'no-sequences': 2,
215
- // restrict what can be thrown as an exception
216
- 'no-throw-literal': 0,
217
- // disallow usage of expressions in statement position
218
- 'no-unused-expressions': 2,
219
- // disallow unnecessary .call() and .apply()
220
- 'no-useless-call': 2,
221
- // disallow unnecessary concatenation of literals or template literals
222
- 'no-useless-concat': 2,
223
- // disallow use of void operator
224
- 'no-void': 2,
225
- // disallow usage of configurable warning terms in comments: e.g. todo
226
- 'no-warning-comments': [
227
- 1,
228
- { terms: ['todo', 'fixme', 'xxx'], location: 'start' }
229
- ],
230
- // disallow use of the with statement
231
- 'no-with': 2,
232
- // require use of the second argument for parseInt()
233
- radix: 2,
234
- // requires to declare all vars on top of their containing scope
235
- 'vars-on-top': 0,
236
- // require immediate function invocation to be wrapped in parentheses
237
- 'wrap-iife': [2, 'any'],
238
- // require or disallow Yoda conditions
239
- yoda: 2,
240
-
241
- // //=========================================================================
242
- // //==================== Strict Mode ========================================
243
- // //=========================================================================
244
- // require that all functions are run in strict mode
245
- // "strict": [2, "global"],
246
- //
247
- //=========================================================================
248
- //==================== Variables ==========================================
249
- //=========================================================================
250
- // enforce or disallow variable initializations at definition
251
- 'init-declarations': 0,
252
- // disallow the catch clause parameter name being the same as a variable in the outer scope
253
- 'no-catch-shadow': 0,
254
- // disallow deletion of variables
255
- 'no-delete-var': 2,
256
- // disallow labels that share a name with a variable
257
- 'no-label-var': 2,
258
- // disallow shadowing of names such as arguments
259
- 'no-shadow-restricted-names': 2,
260
- // disallow declaration of variables already declared in the outer scope
261
- 'no-shadow': 0,
262
- // disallow use of undefined when initializing variables
263
- 'no-undef-init': 0,
264
- // disallow use of undeclared variables unless mentioned in a /*global */ block
265
- 'no-undef': 2,
266
- // disallow use of undefined variable
267
- 'no-undefined': 0,
268
- // disallow declaration of variables that are not used in the code
269
- 'no-unused-vars': [1, { vars: 'local', args: 'after-used' }],
270
- // disallow use of variables before they are defined
271
- 'no-use-before-define': 2,
272
-
273
- //=========================================================================
274
- //==================== Node.js ============================================
275
- //=========================================================================
276
- // enforce return after a callback
277
- 'callback-return': 0,
278
- // disallow require() outside of the top-level module scope
279
- 'global-require': 2,
280
- // enforces error handling in callbacks (node environment)
281
- 'handle-callback-err': 2,
282
- // disallow mixing regular variable and require declarations
283
- 'no-mixed-requires': 2,
284
- // disallow use of new operator with the require function
285
- 'no-new-require': 2,
286
- // disallow string concatenation with __dirname and __filename
287
- 'no-path-concat': 1,
288
- // disallow process.exit()
289
- 'no-process-exit': 2,
290
- // restrict usage of specified node modules
291
- 'no-restricted-modules': 0,
292
- // disallow use of synchronous methods (off by default)
293
- 'no-sync': 0,
294
-
295
- //=========================================================================
296
- //==================== Stylistic Issues ===================================
297
- //=========================================================================
298
- // enforce spacing inside array brackets
299
- 'array-bracket-spacing': 0,
300
- // disallow or enforce spaces inside of single line blocks
301
- 'block-spacing': 1,
302
- // enforce one true brace style
303
- 'brace-style': [1, '1tbs', { allowSingleLine: true }],
304
- // require camel case names
305
- camelcase: [1, { properties: 'always' }],
306
- // enforce spacing before and after comma
307
- 'comma-spacing': [1, { before: false, after: true }],
308
- // enforce one true comma style
309
- 'comma-style': [1, 'last'],
310
- // require or disallow padding inside computed properties
311
- 'computed-property-spacing': 0,
312
- // enforces consistent naming when capturing the current execution context
313
- 'consistent-this': 0,
314
- // enforce newline at the end of file, with no multiple empty lines
315
- 'eol-last': 1,
316
- // require function expressions to have a name
317
- 'func-names': 0,
318
- // enforces use of function declarations or expressions
319
- 'func-style': 0,
320
- // this option enforces minimum and maximum identifier lengths (variable names, property names etc.)
321
- 'id-length': 0,
322
- // require identifiers to match the provided regular expression
323
- 'id-match': 0,
324
- // this option sets a specific tab width for your code
325
- indent: [1, 2, { SwitchCase: 1 }],
326
- // specify whether double or single quotes should be used in JSX attributes
327
- 'jsx-quotes': [1, 'prefer-double'],
328
- // enforces spacing between keys and values in object literal properties
329
- 'key-spacing': [1, { beforeColon: false, afterColon: true }],
330
- // disallow mixed "LF" and "CRLF" as linebreaks
331
- 'linebreak-style': 0,
332
- // enforces empty lines around comments
333
- 'lines-around-comment': 0,
334
- // specify the maximum depth that blocks can be nested
335
- 'max-depth': [0, 4],
336
- // specify the maximum length of a line in your program
337
- 'max-len': [0, 80, 4],
338
- // specify the maximum depth callbacks can be nested
339
- 'max-nested-callbacks': 0,
340
- // limits the number of parameters that can be used in the function declaration.
341
- 'max-params': [0, 3],
342
- // specify the maximum number of statement allowed in a function
343
- 'max-statements': [0, 10],
344
- // require a capital letter for constructors
345
- 'new-cap': [1, { newIsCap: true }],
346
- // disallow the omission of parentheses when invoking a constructor with no arguments
347
- 'new-parens': 0,
348
- // allow/disallow an empty newline after var statement
349
- 'newline-after-var': 0,
350
- // disallow use of the Array constructor
351
- 'no-array-constructor': 0,
352
- // disallow use of bitwise operators
353
- 'no-bitwise': 0,
354
- // disallow use of the continue statement
355
- 'no-continue': 0,
356
- // disallow comments inline after code
357
- 'no-inline-comments': 0,
358
- // disallow if as the only statement in an else block
359
- 'no-lonely-if': 0,
360
- // disallow mixed spaces and tabs for indentation
361
- 'no-mixed-spaces-and-tabs': 1,
362
- // disallow multiple empty lines
363
- 'no-multiple-empty-lines': [1, { max: 2, maxEOF: 1 }],
364
- // disallow negated conditions
365
- 'no-negated-condition': 0,
366
- // disallow nested ternary expressions
367
- 'no-nested-ternary': 1,
368
- // disallow use of the Object constructor
369
- 'no-new-object': 1,
370
- // disallow use of unary operators, ++ and --
371
- 'no-plusplus': 0,
372
- // disallow use of certain syntax in code
373
- 'no-restricted-syntax': 0,
374
- // disallow space between function identifier and application
375
- 'no-spaced-func': 1,
376
- // disallow the use of ternary operators
377
- 'no-ternary': 0,
378
- // disallow trailing whitespace at the end of lines
379
- 'no-trailing-spaces': 1,
380
- // disallow dangling underscores in identifiers
381
- 'no-underscore-dangle': 0,
382
- // disallow the use of Boolean literals in conditional expressions
383
- 'no-unneeded-ternary': 0,
384
- // require or disallow padding inside curly braces
385
- 'object-curly-spacing': 0,
386
- // allow just one var statement per function
387
- 'one-var': [1, 'never'],
388
- // require assignment operator shorthand where possible or prohibit it entirely
389
- 'operator-assignment': 0,
390
- // enforce operators to be placed before or after line breaks
391
- 'operator-linebreak': 0,
392
- // enforce padding within blocks
393
- 'padded-blocks': [1, 'never'],
394
- // require quotes around object literal property names
395
- 'quote-props': 0,
396
- // specify whether double or single quotes should be used
397
- quotes: 0,
398
- // Require JSDoc comment
399
- 'require-jsdoc': 0,
400
- // enforce spacing before and after semicolons
401
- 'semi-spacing': [1, { before: false, after: true }],
402
- // require or disallow use of semicolons instead of ASI
403
- semi: [1, 'always'],
404
- // sort variables within the same declaration block
405
- 'sort-vars': 0,
406
- // require a space after certain keywords
407
- 'keyword-spacing': 1,
408
- // require or disallow space before blocks
409
- 'space-before-blocks': 1,
410
- // require or disallow space before function opening parenthesis
411
- 'space-before-function-paren': [0, { anonymous: 'always', named: 'never' }],
412
- // require or disallow space before blocks
413
- 'space-in-parens': 0,
414
- // require spaces around operators
415
- 'space-infix-ops': 1,
416
- // Require or disallow spaces before/after unary operators
417
- 'space-unary-ops': 0,
418
- // require or disallow a space immediately following the // or /* in a comment
419
- 'spaced-comment': [
420
- 1,
421
- 'always',
422
- {
423
- exceptions: ['-', '+', '/', '='],
424
- markers: ['=', '!', '/'] // space here to support sprockets directives
425
- }
426
- ],
427
- // require regex literals to be wrapped in parentheses
428
- 'wrap-regex': 0,
429
-
430
- //=========================================================================
431
- //==================== ES6 Rules ==========================================
432
- //=========================================================================
433
- 'arrow-body-style': [1, 'as-needed'],
434
- // require parens in arrow function arguments
435
- 'arrow-parens': [1, 'as-needed'],
436
- // require space before/after arrow function"s arrow
437
- 'arrow-spacing': 1,
438
- // verify super() callings in constructors
439
- 'constructor-super': 1,
440
- // enforce the spacing around the * in generator functions
441
- 'generator-star-spacing': 1,
442
- // disallow arrow functions where a condition is expected
443
- 'no-confusing-arrow': 1,
444
- // disallow modifying variables of class declarations
445
- 'no-class-assign': 1,
446
- // disallow modifying variables that are declared using const
447
- 'no-const-assign': 1,
448
- // disallow duplicate name in class members
449
- 'no-dupe-class-members': 1,
450
- // disallow to use this/super before super() calling in constructors.
451
- 'no-this-before-super': 1,
452
- // require let or const instead of var
453
- 'no-var': 0, //TODO: enable on full migration to es6
454
- // require method and property shorthand syntax for object literals
455
- 'object-shorthand': 0,
456
- // suggest using arrow functions as callbacks
457
- 'prefer-arrow-callback': 0, //TODO: enable on full migration to es6
458
- // suggest using of const declaration for variables that are never modified after declared
459
- 'prefer-const': 0, //TODO: enable on full migration to es6
460
- // suggest using Reflect methods where applicable
461
- 'prefer-reflect': 0,
462
- // suggest using the spread operator instead of .apply()
463
- 'prefer-spread': 0,
464
- // suggest using template literals instead of strings concatenation
465
- 'prefer-template': 0, //TODO: enable on full migration to es6
466
- // disallow generator functions that do not have yield
467
- 'require-yield': 0
468
- }
469
- };
1
+ // Rules reference: http://eslint.org/docs/rules/
2
+ module.exports = {
3
+ env: {
4
+ browser: true,
5
+ node: true,
6
+ es6: true,
7
+ mocha: true
8
+ },
9
+
10
+ parser: '@typescript-eslint/parser',
11
+ parserOptions: {
12
+ ecmaVersion: 2018
13
+ },
14
+
15
+ ignorePatterns: ['**/*.js', 'node_modules', 'dist'],
16
+ overrides: [
17
+ {
18
+ files: ['src/**/*.ts'],
19
+ extends: ['plugin:@typescript-eslint/recommended'],
20
+ rules: {
21
+ '@typescript-eslint/no-parameter-properties': 2,
22
+ '@typescript-eslint/no-explicit-any': 0,
23
+ '@typescript-eslint/no-var-requires': 2,
24
+ '@typescript-eslint/no-non-null-assertion': 2,
25
+ '@typescript-eslint/no-use-before-define': 2,
26
+ '@typescript-eslint/camelcase': 0,
27
+ '@typescript-eslint/no-empty-interface': 2,
28
+ '@typescript-eslint/explicit-function-return-type': 2,
29
+ '@typescript-eslint/ban-ts-comment': 0,
30
+ "@typescript-eslint/no-shadow": 2,
31
+ '@typescript-eslint/no-empty-function': [2, { "allow": ["constructors"] }],
32
+ '@typescript-eslint/no-inferrable-types': [
33
+ 2,
34
+ {
35
+ ignoreParameters: true,
36
+ ignoreProperties: true
37
+ }
38
+ ]
39
+ }
40
+ },
41
+ {
42
+ files: ['test/**/*.ts', 'cypress/**/*.ts'],
43
+ extends: ['plugin:cypress/recommended'],
44
+ rules: {
45
+ 'no-unused-expressions': 0,
46
+ 'no-unused-vars': 0
47
+ }
48
+ }
49
+ ],
50
+
51
+ rules: {
52
+ //=========================================================================
53
+ //==================== Possible Errors ====================================
54
+ //=========================================================================
55
+
56
+ // disallow trailing commas in object literals
57
+ 'comma-dangle': [0, 'always-multiline'], //TODO: need discussion
58
+ // disallow assignment in conditional expressions
59
+ 'no-cond-assign': [2, 'always'],
60
+ // disallow use of console
61
+ 'no-console': 1,
62
+ // disallow use of constant expressions in conditions
63
+ 'no-constant-condition': [2, { checkLoops: false }],
64
+ // disallow control characters in regular expressions
65
+ 'no-control-regex': 2,
66
+ // disallow use of debugger
67
+ 'no-debugger': 2,
68
+ // disallow duplicate arguments in functions
69
+ 'no-dupe-args': 2,
70
+ // disallow duplicate keys when creating object literals
71
+ 'no-dupe-keys': 2,
72
+ // disallow a duplicate case label.
73
+ 'no-duplicate-case': 2,
74
+ // disallow the use of empty character classes in regular expressions
75
+ 'no-empty-character-class': 2,
76
+ // disallow empty statements
77
+ 'no-empty': 2,
78
+ // disallow assigning to the exception in a catch block
79
+ 'no-ex-assign': 2,
80
+ // disallow double-negation boolean casts in a boolean context
81
+ 'no-extra-boolean-cast': 2,
82
+ // disallow unnecessary parentheses
83
+ 'no-extra-parens': [2, 'functions'],
84
+ // disallow unnecessary semicolons
85
+ 'no-extra-semi': 2,
86
+ // disallow overwriting functions written as function declarations
87
+ 'no-func-assign': 2,
88
+ // disallow function or variable declarations in nested blocks
89
+ 'no-inner-declarations': 2,
90
+ // disallow invalid regular expression strings in the RegExp constructor
91
+ 'no-invalid-regexp': 2,
92
+ // disallow irregular whitespace outside of strings and comments
93
+ 'no-irregular-whitespace': 2,
94
+ // disallow negation of the left operand of an in expression
95
+ 'no-negated-in-lhs': 2,
96
+ // disallow the use of object properties of the global object (Math and JSON) as functions
97
+ 'no-obj-calls': 2,
98
+ // disallow multiple spaces in a regular expression literal
99
+ 'no-regex-spaces': 2,
100
+ // disallow sparse arrays
101
+ 'no-sparse-arrays': 2,
102
+ // Avoid code that looks like two expressions but is actually one
103
+ 'no-unexpected-multiline': 2,
104
+ // disallow unreachable statements after a return, throw, continue, or break statement
105
+ 'no-unreachable': 2,
106
+ // disallow comparisons with the value NaN
107
+ 'use-isnan': 2,
108
+ // ensure JSDoc comments are valid
109
+ 'valid-jsdoc': [
110
+ 0,
111
+ {
112
+ requireReturn: false,
113
+ requireReturnDescription: false
114
+ }
115
+ ],
116
+ // ensure that the results of typeof are compared against a valid string
117
+ 'valid-typeof': 2,
118
+
119
+ //=========================================================================
120
+ //==================== Best Practices =====================================
121
+ //=========================================================================
122
+ // Enforces getter/setter pairs in objects
123
+ 'accessor-pairs': 2,
124
+ // treat var statements as if they were block scoped
125
+ 'block-scoped-var': 2,
126
+ // specify the maximum cyclomatic complexity allowed in a program
127
+ complexity: [0, 11],
128
+ // require return statements to either always or never specify values
129
+ 'consistent-return': 2,
130
+ // specify curly brace conventions for all control statements
131
+ curly: [2, 'multi-line'],
132
+ // require default case in switch statements
133
+ 'default-case': 2,
134
+ // encourages use of dot notation whenever possible
135
+ 'dot-notation': [2, { allowKeywords: true }],
136
+ // enforces consistent newlines before or after dots
137
+ 'dot-location': [2, 'property'],
138
+ // require the use of === and !==
139
+ eqeqeq: 2,
140
+ // make sure for-in loops have an if statement
141
+ 'guard-for-in': 2,
142
+ // disallow the use of alert, confirm, and prompt
143
+ 'no-alert': 2,
144
+ // disallow use of arguments.caller or arguments.callee
145
+ 'no-caller': 2,
146
+ // disallow lexical declarations in case clauses
147
+ 'no-case-declarations': 2,
148
+ // disallow division operators explicitly at beginning of regular expression
149
+ 'no-div-regex': 2,
150
+ // disallow else after a return in an if
151
+ 'no-else-return': 0,
152
+ // disallow use of empty destructuring patterns
153
+ 'no-empty-pattern': 2,
154
+ // disallow comparisons to null without a type-checking operator
155
+ 'no-eq-null': 2,
156
+ // disallow use of eval()
157
+ 'no-eval': 2,
158
+ // disallow adding to native types
159
+ 'no-extend-native': 2,
160
+ // disallow unnecessary function binding
161
+ 'no-extra-bind': 2,
162
+ // disallow fallthrough of case statements
163
+ 'no-fallthrough': 2,
164
+ // disallow the use of leading or trailing decimal points in numeric literals
165
+ 'no-floating-decimal': 2,
166
+ // disallow the type conversions with shorter notations
167
+ 'no-implicit-coercion': 2,
168
+ // disallow use of eval()-like methods
169
+ 'no-implied-eval': 2,
170
+ // disallow this keywords outside of classes or class-like objects
171
+ 'no-invalid-this': 0,
172
+ // disallow usage of __iterator__ property
173
+ 'no-iterator': 2,
174
+ // disallow use of labeled statements
175
+ 'no-labels': 2,
176
+ // disallow unnecessary nested blocks
177
+ 'no-lone-blocks': 2,
178
+ // disallow creation of functions within loops
179
+ 'no-loop-func': 2,
180
+ // disallow the use of magic numbers
181
+ 'no-magic-numbers': 0, //TODO: need discussion
182
+ // disallow use of multiple spaces
183
+ 'no-multi-spaces': 2,
184
+ // disallow use of multiline strings
185
+ 'no-multi-str': 2,
186
+ // disallow reassignments of native objects
187
+ 'no-native-reassign': 2,
188
+ // disallow use of new operator for Function object
189
+ 'no-new-func': 2,
190
+ // disallows creating new instances of String,Number, and Boolean
191
+ 'no-new-wrappers': 2,
192
+ // disallow use of new operator when not part of the assignment or comparison
193
+ 'no-new': 2,
194
+ // disallow use of octal escape sequences in string literals, such as
195
+ // var foo = "Copyright \251";
196
+ 'no-octal-escape': 2,
197
+ // disallow use of (old style) octal literals
198
+ 'no-octal': 2,
199
+ // disallow reassignment of function parameters
200
+ 'no-param-reassign': 2,
201
+ // disallow use of process.env
202
+ 'no-process-env': 2,
203
+ // disallow usage of __proto__ property
204
+ 'no-proto': 2,
205
+ // disallow declaring the same variable more then once
206
+ 'no-redeclare': 2,
207
+ // disallow use of assignment in return statement
208
+ 'no-return-assign': 2,
209
+ // disallow use of `javascript:` urls.
210
+ 'no-script-url': 2,
211
+ // disallow comparisons where both sides are exactly the same
212
+ 'no-self-compare': 2,
213
+ // disallow use of comma operator
214
+ 'no-sequences': 2,
215
+ // restrict what can be thrown as an exception
216
+ 'no-throw-literal': 0,
217
+ // disallow usage of expressions in statement position
218
+ 'no-unused-expressions': 2,
219
+ // disallow unnecessary .call() and .apply()
220
+ 'no-useless-call': 2,
221
+ // disallow unnecessary concatenation of literals or template literals
222
+ 'no-useless-concat': 2,
223
+ // disallow use of void operator
224
+ 'no-void': 2,
225
+ // disallow usage of configurable warning terms in comments: e.g. todo
226
+ 'no-warning-comments': [
227
+ 1,
228
+ { terms: ['todo', 'fixme', 'xxx'], location: 'start' }
229
+ ],
230
+ // disallow use of the with statement
231
+ 'no-with': 2,
232
+ // require use of the second argument for parseInt()
233
+ radix: 2,
234
+ // requires to declare all vars on top of their containing scope
235
+ 'vars-on-top': 0,
236
+ // require immediate function invocation to be wrapped in parentheses
237
+ 'wrap-iife': [2, 'any'],
238
+ // require or disallow Yoda conditions
239
+ yoda: 2,
240
+
241
+ // //=========================================================================
242
+ // //==================== Strict Mode ========================================
243
+ // //=========================================================================
244
+ // require that all functions are run in strict mode
245
+ // "strict": [2, "global"],
246
+ //
247
+ //=========================================================================
248
+ //==================== Variables ==========================================
249
+ //=========================================================================
250
+ // enforce or disallow variable initializations at definition
251
+ 'init-declarations': 0,
252
+ // disallow the catch clause parameter name being the same as a variable in the outer scope
253
+ 'no-catch-shadow': 0,
254
+ // disallow deletion of variables
255
+ 'no-delete-var': 2,
256
+ // disallow labels that share a name with a variable
257
+ 'no-label-var': 2,
258
+ // disallow shadowing of names such as arguments
259
+ 'no-shadow-restricted-names': 2,
260
+ // disallow declaration of variables already declared in the outer scope
261
+ 'no-shadow': 0,
262
+ // disallow use of undefined when initializing variables
263
+ 'no-undef-init': 0,
264
+ // disallow use of undeclared variables unless mentioned in a /*global */ block
265
+ 'no-undef': 2,
266
+ // disallow use of undefined variable
267
+ 'no-undefined': 0,
268
+ // disallow declaration of variables that are not used in the code
269
+ 'no-unused-vars': [1, { vars: 'local', args: 'after-used' }],
270
+ // disallow use of variables before they are defined
271
+ 'no-use-before-define': 2,
272
+
273
+ //=========================================================================
274
+ //==================== Node.js ============================================
275
+ //=========================================================================
276
+ // enforce return after a callback
277
+ 'callback-return': 0,
278
+ // disallow require() outside of the top-level module scope
279
+ 'global-require': 2,
280
+ // enforces error handling in callbacks (node environment)
281
+ 'handle-callback-err': 2,
282
+ // disallow mixing regular variable and require declarations
283
+ 'no-mixed-requires': 2,
284
+ // disallow use of new operator with the require function
285
+ 'no-new-require': 2,
286
+ // disallow string concatenation with __dirname and __filename
287
+ 'no-path-concat': 1,
288
+ // disallow process.exit()
289
+ 'no-process-exit': 2,
290
+ // restrict usage of specified node modules
291
+ 'no-restricted-modules': 0,
292
+ // disallow use of synchronous methods (off by default)
293
+ 'no-sync': 0,
294
+
295
+ //=========================================================================
296
+ //==================== Stylistic Issues ===================================
297
+ //=========================================================================
298
+ // enforce spacing inside array brackets
299
+ 'array-bracket-spacing': 0,
300
+ // disallow or enforce spaces inside of single line blocks
301
+ 'block-spacing': 1,
302
+ // enforce one true brace style
303
+ 'brace-style': [1, '1tbs', { allowSingleLine: true }],
304
+ // require camel case names
305
+ camelcase: [1, { properties: 'always' }],
306
+ // enforce spacing before and after comma
307
+ 'comma-spacing': [1, { before: false, after: true }],
308
+ // enforce one true comma style
309
+ 'comma-style': [1, 'last'],
310
+ // require or disallow padding inside computed properties
311
+ 'computed-property-spacing': 0,
312
+ // enforces consistent naming when capturing the current execution context
313
+ 'consistent-this': 0,
314
+ // enforce newline at the end of file, with no multiple empty lines
315
+ 'eol-last': 1,
316
+ // require function expressions to have a name
317
+ 'func-names': 0,
318
+ // enforces use of function declarations or expressions
319
+ 'func-style': 0,
320
+ // this option enforces minimum and maximum identifier lengths (variable names, property names etc.)
321
+ 'id-length': 0,
322
+ // require identifiers to match the provided regular expression
323
+ 'id-match': 0,
324
+ // this option sets a specific tab width for your code
325
+ indent: [1, 2, { SwitchCase: 1 }],
326
+ // specify whether double or single quotes should be used in JSX attributes
327
+ 'jsx-quotes': [1, 'prefer-double'],
328
+ // enforces spacing between keys and values in object literal properties
329
+ 'key-spacing': [1, { beforeColon: false, afterColon: true }],
330
+ // disallow mixed "LF" and "CRLF" as linebreaks
331
+ 'linebreak-style': 0,
332
+ // enforces empty lines around comments
333
+ 'lines-around-comment': 0,
334
+ // specify the maximum depth that blocks can be nested
335
+ 'max-depth': [0, 4],
336
+ // specify the maximum length of a line in your program
337
+ 'max-len': [0, 80, 4],
338
+ // specify the maximum depth callbacks can be nested
339
+ 'max-nested-callbacks': 0,
340
+ // limits the number of parameters that can be used in the function declaration.
341
+ 'max-params': [0, 3],
342
+ // specify the maximum number of statement allowed in a function
343
+ 'max-statements': [0, 10],
344
+ // require a capital letter for constructors
345
+ 'new-cap': [1, { newIsCap: true }],
346
+ // disallow the omission of parentheses when invoking a constructor with no arguments
347
+ 'new-parens': 0,
348
+ // allow/disallow an empty newline after var statement
349
+ 'newline-after-var': 0,
350
+ // disallow use of the Array constructor
351
+ 'no-array-constructor': 0,
352
+ // disallow use of bitwise operators
353
+ 'no-bitwise': 0,
354
+ // disallow use of the continue statement
355
+ 'no-continue': 0,
356
+ // disallow comments inline after code
357
+ 'no-inline-comments': 0,
358
+ // disallow if as the only statement in an else block
359
+ 'no-lonely-if': 0,
360
+ // disallow mixed spaces and tabs for indentation
361
+ 'no-mixed-spaces-and-tabs': 1,
362
+ // disallow multiple empty lines
363
+ 'no-multiple-empty-lines': [1, { max: 2, maxEOF: 1 }],
364
+ // disallow negated conditions
365
+ 'no-negated-condition': 0,
366
+ // disallow nested ternary expressions
367
+ 'no-nested-ternary': 1,
368
+ // disallow use of the Object constructor
369
+ 'no-new-object': 1,
370
+ // disallow use of unary operators, ++ and --
371
+ 'no-plusplus': 0,
372
+ // disallow use of certain syntax in code
373
+ 'no-restricted-syntax': 0,
374
+ // disallow space between function identifier and application
375
+ 'no-spaced-func': 1,
376
+ // disallow the use of ternary operators
377
+ 'no-ternary': 0,
378
+ // disallow trailing whitespace at the end of lines
379
+ 'no-trailing-spaces': 1,
380
+ // disallow dangling underscores in identifiers
381
+ 'no-underscore-dangle': 0,
382
+ // disallow the use of Boolean literals in conditional expressions
383
+ 'no-unneeded-ternary': 0,
384
+ // require or disallow padding inside curly braces
385
+ 'object-curly-spacing': 0,
386
+ // allow just one var statement per function
387
+ 'one-var': [1, 'never'],
388
+ // require assignment operator shorthand where possible or prohibit it entirely
389
+ 'operator-assignment': 0,
390
+ // enforce operators to be placed before or after line breaks
391
+ 'operator-linebreak': 0,
392
+ // enforce padding within blocks
393
+ 'padded-blocks': [1, 'never'],
394
+ // require quotes around object literal property names
395
+ 'quote-props': 0,
396
+ // specify whether double or single quotes should be used
397
+ quotes: 0,
398
+ // Require JSDoc comment
399
+ 'require-jsdoc': 0,
400
+ // enforce spacing before and after semicolons
401
+ 'semi-spacing': [1, { before: false, after: true }],
402
+ // require or disallow use of semicolons instead of ASI
403
+ semi: [1, 'always'],
404
+ // sort variables within the same declaration block
405
+ 'sort-vars': 0,
406
+ // require a space after certain keywords
407
+ 'keyword-spacing': 1,
408
+ // require or disallow space before blocks
409
+ 'space-before-blocks': 1,
410
+ // require or disallow space before function opening parenthesis
411
+ 'space-before-function-paren': [0, { anonymous: 'always', named: 'never' }],
412
+ // require or disallow space before blocks
413
+ 'space-in-parens': 0,
414
+ // require spaces around operators
415
+ 'space-infix-ops': 1,
416
+ // Require or disallow spaces before/after unary operators
417
+ 'space-unary-ops': 0,
418
+ // require or disallow a space immediately following the // or /* in a comment
419
+ 'spaced-comment': [
420
+ 1,
421
+ 'always',
422
+ {
423
+ exceptions: ['-', '+', '/', '='],
424
+ markers: ['=', '!', '/'] // space here to support sprockets directives
425
+ }
426
+ ],
427
+ // require regex literals to be wrapped in parentheses
428
+ 'wrap-regex': 0,
429
+
430
+ //=========================================================================
431
+ //==================== ES6 Rules ==========================================
432
+ //=========================================================================
433
+ 'arrow-body-style': [1, 'as-needed'],
434
+ // require parens in arrow function arguments
435
+ 'arrow-parens': [1, 'as-needed'],
436
+ // require space before/after arrow function"s arrow
437
+ 'arrow-spacing': 1,
438
+ // verify super() callings in constructors
439
+ 'constructor-super': 1,
440
+ // enforce the spacing around the * in generator functions
441
+ 'generator-star-spacing': 1,
442
+ // disallow arrow functions where a condition is expected
443
+ 'no-confusing-arrow': 1,
444
+ // disallow modifying variables of class declarations
445
+ 'no-class-assign': 1,
446
+ // disallow modifying variables that are declared using const
447
+ 'no-const-assign': 1,
448
+ // disallow duplicate name in class members
449
+ 'no-dupe-class-members': 1,
450
+ // disallow to use this/super before super() calling in constructors.
451
+ 'no-this-before-super': 1,
452
+ // require let or const instead of var
453
+ 'no-var': 0, //TODO: enable on full migration to es6
454
+ // require method and property shorthand syntax for object literals
455
+ 'object-shorthand': 0,
456
+ // suggest using arrow functions as callbacks
457
+ 'prefer-arrow-callback': 0, //TODO: enable on full migration to es6
458
+ // suggest using of const declaration for variables that are never modified after declared
459
+ 'prefer-const': 0, //TODO: enable on full migration to es6
460
+ // suggest using Reflect methods where applicable
461
+ 'prefer-reflect': 0,
462
+ // suggest using the spread operator instead of .apply()
463
+ 'prefer-spread': 0,
464
+ // suggest using template literals instead of strings concatenation
465
+ 'prefer-template': 0, //TODO: enable on full migration to es6
466
+ // disallow generator functions that do not have yield
467
+ 'require-yield': 0
468
+ }
469
+ };