1 | module.exports = {
|
2 | rules: {
|
3 | // enforce getter and setter pairs in objects
|
4 | // http://eslint.org/docs/rules/accessor-pairs
|
5 | 'accessor-pairs': 'off',
|
6 |
|
7 | // enforce return statements in callbacks of array methods
|
8 | // http://eslint.org/docs/rules/array-callback-return
|
9 | 'array-callback-return': 'error',
|
10 |
|
11 | // enforce the use of variables within the scope they are defined
|
12 | // http://eslint.org/docs/rules/block-scoped-var
|
13 | 'block-scoped-var': 'error',
|
14 |
|
15 | // enforce that class methods utilize this
|
16 | // http://eslint.org/docs/rules/class-methods-use-this
|
17 | 'class-methods-use-this': ['error', {
|
18 | exceptMethods: [],
|
19 | }],
|
20 |
|
21 | // enforce a maximum cyclomatic complexity allowed in a program
|
22 | // http://eslint.org/docs/rules/complexity
|
23 | complexity: ['off', 11],
|
24 |
|
25 | // require return statements to either always or never specify values
|
26 | // http://eslint.org/docs/rules/consistent-return
|
27 | 'consistent-return': 'error',
|
28 |
|
29 | // enforce consistent brace style for all control statements
|
30 | // http://eslint.org/docs/rules/curly
|
31 | // This is handled by Prettier in Defaults 2.0
|
32 | curly: 'off',
|
33 |
|
34 | // require default cases in switch statements
|
35 | // http://eslint.org/docs/rules/default-case
|
36 | 'default-case': ['error', { commentPattern: '^no default$' }],
|
37 |
|
38 | // enforce consistent newlines before and after dots
|
39 | // http://eslint.org/docs/rules/dot-location
|
40 | // This is handled by Prettier in Defaults 2.0
|
41 | 'dot-location': 'off',
|
42 |
|
43 | // enforce dot notation whenever possible
|
44 | // http://eslint.org/docs/rules/dot-notation
|
45 | 'dot-notation': ['error', { allowKeywords: true }],
|
46 |
|
47 | // require the use of === and !==
|
48 | // http://eslint.org/docs/rules/eqeqeq
|
49 | eqeqeq: ['error', 'always', { null: 'ignore' }],
|
50 |
|
51 | // require for-in loops to include an if statement
|
52 | // http://eslint.org/docs/rules/guard-for-in
|
53 | 'guard-for-in': 'error',
|
54 |
|
55 | // disallow the use of alert, confirm, and prompt
|
56 | // http://eslint.org/docs/rules/no-alert
|
57 | 'no-alert': 'warn',
|
58 |
|
59 | // disallow the use of arguments.caller or arguments.callee
|
60 | // http://eslint.org/docs/rules/no-caller
|
61 | 'no-caller': 'error',
|
62 |
|
63 | // disallow lexical declarations in case clauses
|
64 | // http://eslint.org/docs/rules/no-case-declarations.html
|
65 | 'no-case-declarations': 'error',
|
66 |
|
67 | // disallow division operators explicitly at the beginning of regular expressions
|
68 | // http://eslint.org/docs/rules/no-div-regex
|
69 | 'no-div-regex': 'off',
|
70 |
|
71 | // disallow else blocks after return statements in if statements
|
72 | // http://eslint.org/docs/rules/no-else-return
|
73 | 'no-else-return': 'error',
|
74 |
|
75 | // disallow empty functions
|
76 | // http://eslint.org/docs/rules/no-empty-function
|
77 | 'no-empty-function': ['error', {
|
78 | allow: [
|
79 | 'arrowFunctions',
|
80 | 'functions',
|
81 | 'methods',
|
82 | ],
|
83 | }],
|
84 |
|
85 | // disallow empty destructuring patterns
|
86 | // http://eslint.org/docs/rules/no-empty-pattern
|
87 | 'no-empty-pattern': 'error',
|
88 |
|
89 | // disallow null comparisons without type-checking operators
|
90 | // http://eslint.org/docs/rules/no-eq-null
|
91 | 'no-eq-null': 'off',
|
92 |
|
93 | // disallow the use of eval()
|
94 | // http://eslint.org/docs/rules/no-eval
|
95 | 'no-eval': 'error',
|
96 |
|
97 | // disallow extending native types
|
98 | // http://eslint.org/docs/rules/no-extend-native
|
99 | 'no-extend-native': 'error',
|
100 |
|
101 | // disallow unnecessary calls to .bind()
|
102 | // http://eslint.org/docs/rules/no-extra-bind
|
103 | 'no-extra-bind': 'error',
|
104 |
|
105 | // disallow unnecessary labels
|
106 | // http://eslint.org/docs/rules/no-extra-label
|
107 | 'no-extra-label': 'error',
|
108 |
|
109 | // disallow fallthrough of case statements
|
110 | // http://eslint.org/docs/rules/no-fallthrough
|
111 | 'no-fallthrough': 'error',
|
112 |
|
113 | // disallow leading or trailing decimal points in numeric literals
|
114 | // http://eslint.org/docs/rules/no-floating-decimal
|
115 | // This is handled by Prettier in Defaults 2.0
|
116 | 'no-floating-decimal': 'off',
|
117 |
|
118 | // disallow assignments to native objects or read-only global variables
|
119 | // http://eslint.org/docs/rules/no-global-assign
|
120 | 'no-global-assign': ['error', { exceptions: [] }],
|
121 |
|
122 | // disallow shorthand type conversions
|
123 | // http://eslint.org/docs/rules/no-implicit-coercion
|
124 | 'no-implicit-coercion': ['off', {
|
125 | boolean: false,
|
126 | number: true,
|
127 | string: true,
|
128 | allow: [],
|
129 | }],
|
130 |
|
131 | // disallow variable and function declarations in the global scope
|
132 | // http://eslint.org/docs/rules/no-implicit-globals
|
133 | 'no-implicit-globals': 'off',
|
134 |
|
135 | // disallow the use of eval()-like methods
|
136 | // http://eslint.org/docs/rules/no-implied-eval
|
137 | 'no-implied-eval': 'error',
|
138 |
|
139 | // disallow this keywords outside of classes or class-like objects
|
140 | // http://eslint.org/docs/rules/no-invalid-this
|
141 | 'no-invalid-this': 'off',
|
142 |
|
143 | // disallow the use of the __iterator__ property
|
144 | // http://eslint.org/docs/rules/no-iterator
|
145 | 'no-iterator': 'error',
|
146 |
|
147 | // disallow labeled statements
|
148 | // http://eslint.org/docs/rules/no-labels
|
149 | 'no-labels': ['error', { allowLoop: false, allowSwitch: false }],
|
150 |
|
151 | // disallow unnecessary nested blocks
|
152 | // http://eslint.org/docs/rules/no-lone-blocks
|
153 | 'no-lone-blocks': 'error',
|
154 |
|
155 | // disallow function declarations and expressions inside loop statements
|
156 | // http://eslint.org/docs/rules/no-loop-func
|
157 | 'no-loop-func': 'error',
|
158 |
|
159 | // disallow magic numbers
|
160 | // http://eslint.org/docs/rules/no-magic-numbers
|
161 | 'no-magic-numbers': ['off', {
|
162 | ignore: [],
|
163 | ignoreArrayIndexes: true,
|
164 | enforceConst: true,
|
165 | detectObjects: false,
|
166 | }],
|
167 |
|
168 | // disallow multiple spaces
|
169 | // http://eslint.org/docs/rules/no-multi-spaces
|
170 | // This is handled by Prettier in Defaults 2.0
|
171 | 'no-multi-spaces': 'off',
|
172 |
|
173 | // disallow multiline strings
|
174 | // http://eslint.org/docs/rules/no-multi-str
|
175 | 'no-multi-str': 'error',
|
176 |
|
177 | // disallow new operators with the Function object
|
178 | // http://eslint.org/docs/rules/no-new-func
|
179 | 'no-new-func': 'error',
|
180 |
|
181 | // disallow new operators with the String, Number, and Boolean objects
|
182 | // http://eslint.org/docs/rules/no-new-wrappers
|
183 | 'no-new-wrappers': 'error',
|
184 |
|
185 | // disallow new operators outside of assignments or comparisons
|
186 | // http://eslint.org/docs/rules/no-new
|
187 | 'no-new': 'error',
|
188 |
|
189 | // disallow octal escape sequences in string literals
|
190 | // http://eslint.org/docs/rules/no-octal-escape
|
191 | 'no-octal-escape': 'error',
|
192 |
|
193 | // disallow octal literals
|
194 | // http://eslint.org/docs/rules/no-octal
|
195 | 'no-octal': 'error',
|
196 |
|
197 | // disallow reassigning function parameters
|
198 | // rule: http://eslint.org/docs/rules/no-param-reassign.html
|
199 | 'no-param-reassign': ['warn', { props: true }],
|
200 |
|
201 | // disallow the use of the __proto__ property
|
202 | // http://eslint.org/docs/rules/no-proto
|
203 | 'no-proto': 'error',
|
204 |
|
205 | // disallow variable redeclaration
|
206 | // http://eslint.org/docs/rules/no-redeclare
|
207 | 'no-redeclare': 'error',
|
208 |
|
209 | // disallow certain properties on certain objects
|
210 | // http://eslint.org/docs/rules/no-restricted-properties
|
211 | 'no-restricted-properties': ['error', {
|
212 | object: 'arguments',
|
213 | property: 'callee',
|
214 | message: 'arguments.callee is deprecated',
|
215 | }, {
|
216 | property: '__defineGetter__',
|
217 | message: 'Please use Object.defineProperty instead.',
|
218 | }, {
|
219 | property: '__defineSetter__',
|
220 | message: 'Please use Object.defineProperty instead.',
|
221 | }, {
|
222 | object: 'Math',
|
223 | property: 'pow',
|
224 | message: 'Use the exponentiation operator (**) instead.',
|
225 | }],
|
226 |
|
227 | // disallow assignment operators in return statements
|
228 | // http://eslint.org/docs/rules/no-return-assign
|
229 | 'no-return-assign': 'error',
|
230 |
|
231 | // disallow unnecessary return await
|
232 | // http://eslint.org/docs/rules/no-return-await
|
233 | 'no-return-await': 'error',
|
234 |
|
235 | // disallow javascript: urls
|
236 | // http://eslint.org/docs/rules/no-script-url
|
237 | 'no-script-url': 'error',
|
238 |
|
239 | // disallow assignments where both sides are exactly the same
|
240 | // http://eslint.org/docs/rules/no-self-assign
|
241 | 'no-self-assign': 'error',
|
242 |
|
243 | // disallow comparisons where both sides are exactly the same
|
244 | // http://eslint.org/docs/rules/no-self-compare
|
245 | 'no-self-compare': 'error',
|
246 |
|
247 | // disallow comma operators
|
248 | // http://eslint.org/docs/rules/no-sequences
|
249 | 'no-sequences': 'error',
|
250 |
|
251 | // disallow throwing literals as exceptions
|
252 | // http://eslint.org/docs/rules/no-throw-literal
|
253 | 'no-throw-literal': 'error',
|
254 |
|
255 | // disallow unmodified loop conditions
|
256 | // http://eslint.org/docs/rules/no-unmodified-loop-condition
|
257 | 'no-unmodified-loop-condition': 'off',
|
258 |
|
259 | // disallow unused expressions
|
260 | // http://eslint.org/docs/rules/no-unused-expressions
|
261 | 'no-unused-expressions': ['error', {
|
262 | allowShortCircuit: false,
|
263 | allowTernary: false,
|
264 | }],
|
265 |
|
266 | // disallow unused labels
|
267 | // http://eslint.org/docs/rules/no-unused-labels
|
268 | 'no-unused-labels': 'error',
|
269 |
|
270 | // disallow unnecessary calls to .call() and .apply()
|
271 | // http://eslint.org/docs/rules/no-useless-call
|
272 | 'no-useless-call': 'off',
|
273 |
|
274 | // disallow unnecessary concatenation of literals or template literals
|
275 | // http://eslint.org/docs/rules/no-useless-concat
|
276 | 'no-useless-concat': 'error',
|
277 |
|
278 | // disallow unnecessary escape characters
|
279 | // http://eslint.org/docs/rules/no-useless-escape
|
280 | 'no-useless-escape': 'error',
|
281 |
|
282 | // disallow redundant return statements
|
283 | // http://eslint.org/docs/rules/no-useless-return
|
284 | 'no-useless-return': 'error',
|
285 |
|
286 | // disallow void operators
|
287 | // http://eslint.org/docs/rules/no-void
|
288 | 'no-void': 'error',
|
289 |
|
290 | // disallow specified warning terms in comments
|
291 | // http://eslint.org/docs/rules/no-warning-comments
|
292 | 'no-warning-comments': ['off', { terms: ['todo', 'fixme', 'xxx'], location: 'start' }],
|
293 |
|
294 | // disallow with statements
|
295 | // http://eslint.org/docs/rules/no-with
|
296 | 'no-with': 'error',
|
297 |
|
298 | // require using Error objects as Promise rejection reasons
|
299 | // http://eslint.org/docs/rules/prefer-promise-reject-errors
|
300 | 'prefer-promise-reject-errors': ['error', { allowEmptyReject: true }],
|
301 |
|
302 | // enforce the consistent use of the radix argument when using parseInt()
|
303 | // http://eslint.org/docs/rules/radix
|
304 | radix: 'error',
|
305 |
|
306 | // disallow async functions which have no await expression
|
307 | // http://eslint.org/docs/rules/require-await
|
308 | 'require-await': 'off',
|
309 |
|
310 | // require var declarations be placed at the top of their containing scope
|
311 | // http://eslint.org/docs/rules/vars-on-top
|
312 | 'vars-on-top': 'error',
|
313 |
|
314 | // require parentheses around immediate function invocations
|
315 | // http://eslint.org/docs/rules/wrap-iife.html
|
316 | // This is handled by Prettier in Defaults 2.0
|
317 | 'wrap-iife': 'off',
|
318 |
|
319 | // require or disallow “Yoda” conditions
|
320 | // http://eslint.org/docs/rules/yoda
|
321 | yoda: 'error',
|
322 | },
|
323 | };
|