]>
Commit | Line | Data |
---|---|---|
eb39fafa DC |
1 | /** |
2 | * @fileoverview Tests for func-call-spacing rule. | |
3 | * @author Matt DuVall <http://www.mattduvall.com> | |
4 | */ | |
5 | ||
6 | "use strict"; | |
7 | ||
8 | //------------------------------------------------------------------------------ | |
9 | // Requirements | |
10 | //------------------------------------------------------------------------------ | |
11 | ||
12 | const rule = require("../../../lib/rules/func-call-spacing"), | |
13 | { RuleTester } = require("../../../lib/rule-tester"); | |
14 | ||
15 | //------------------------------------------------------------------------------ | |
16 | // Tests | |
17 | //------------------------------------------------------------------------------ | |
18 | ||
19 | const ruleTester = new RuleTester(); | |
20 | ||
21 | ruleTester.run("func-call-spacing", rule, { | |
22 | valid: [ | |
23 | ||
24 | // default ("never") | |
25 | "f();", | |
26 | "f(a, b);", | |
27 | "f.b();", | |
28 | "f.b().c();", | |
29 | "f()()", | |
30 | "(function() {}())", | |
31 | "var f = new Foo()", | |
32 | "var f = new Foo", | |
33 | "f( (0) )", | |
34 | "( f )( 0 )", | |
35 | "( (f) )( (0) )", | |
36 | "( f()() )(0)", | |
37 | "(function(){ if (foo) { bar(); } }());", | |
38 | "f(0, (1))", | |
39 | "describe/**/('foo', function () {});", | |
40 | "new (foo())", | |
41 | { | |
42 | code: "import(source)", | |
43 | parserOptions: { ecmaVersion: 2020 } | |
44 | }, | |
45 | ||
46 | // "never" | |
47 | { | |
48 | code: "f();", | |
49 | options: ["never"] | |
50 | }, | |
51 | { | |
52 | code: "f(a, b);", | |
53 | options: ["never"] | |
54 | }, | |
55 | { | |
56 | code: "f.b();", | |
57 | options: ["never"] | |
58 | }, | |
59 | { | |
60 | code: "f.b().c();", | |
61 | options: ["never"] | |
62 | }, | |
63 | { | |
64 | code: "f()()", | |
65 | options: ["never"] | |
66 | }, | |
67 | { | |
68 | code: "(function() {}())", | |
69 | options: ["never"] | |
70 | }, | |
71 | { | |
72 | code: "var f = new Foo()", | |
73 | options: ["never"] | |
74 | }, | |
75 | { | |
76 | code: "var f = new Foo", | |
77 | options: ["never"] | |
78 | }, | |
79 | { | |
80 | code: "f( (0) )", | |
81 | options: ["never"] | |
82 | }, | |
83 | { | |
84 | code: "( f )( 0 )", | |
85 | options: ["never"] | |
86 | }, | |
87 | { | |
88 | code: "( (f) )( (0) )", | |
89 | options: ["never"] | |
90 | }, | |
91 | { | |
92 | code: "( f()() )(0)", | |
93 | options: ["never"] | |
94 | }, | |
95 | { | |
96 | code: "(function(){ if (foo) { bar(); } }());", | |
97 | options: ["never"] | |
98 | }, | |
99 | { | |
100 | code: "f(0, (1))", | |
101 | options: ["never"] | |
102 | }, | |
103 | { | |
104 | code: "describe/**/('foo', function () {});", | |
105 | options: ["never"] | |
106 | }, | |
107 | { | |
108 | code: "new (foo())", | |
109 | options: ["never"] | |
110 | }, | |
111 | { | |
112 | code: "import(source)", | |
113 | options: ["never"], | |
114 | parserOptions: { ecmaVersion: 2020 } | |
115 | }, | |
116 | ||
117 | // "always" | |
118 | { | |
119 | code: "f ();", | |
120 | options: ["always"] | |
121 | }, | |
122 | { | |
123 | code: "f (a, b);", | |
124 | options: ["always"] | |
125 | }, | |
126 | { | |
127 | code: "f.b ();", | |
128 | options: ["always"] | |
129 | }, | |
130 | { | |
131 | code: "f.b ().c ();", | |
132 | options: ["always"] | |
133 | }, | |
134 | { | |
135 | code: "f () ()", | |
136 | options: ["always"] | |
137 | }, | |
138 | { | |
139 | code: "(function() {} ())", | |
140 | options: ["always"] | |
141 | }, | |
142 | { | |
143 | code: "var f = new Foo ()", | |
144 | options: ["always"] | |
145 | }, | |
146 | { | |
147 | code: "var f = new Foo", | |
148 | options: ["always"] | |
149 | }, | |
150 | { | |
151 | code: "f ( (0) )", | |
152 | options: ["always"] | |
153 | }, | |
154 | { | |
155 | code: "f (0) (1)", | |
156 | options: ["always"] | |
157 | }, | |
158 | { | |
159 | code: "(f) (0)", | |
160 | options: ["always"] | |
161 | }, | |
162 | { | |
163 | code: "f ();\n t ();", | |
164 | options: ["always"] | |
165 | }, | |
166 | { | |
167 | code: "import (source)", | |
168 | options: ["always"], | |
169 | parserOptions: { ecmaVersion: 2020 } | |
170 | }, | |
171 | ||
172 | // "always", "allowNewlines": true | |
173 | { | |
174 | code: "f\n();", | |
175 | options: ["always", { allowNewlines: true }] | |
176 | }, | |
177 | { | |
178 | code: "f.b \n ();", | |
179 | options: ["always", { allowNewlines: true }] | |
180 | }, | |
181 | { | |
182 | code: "f\n() ().b \n()\n ()", | |
183 | options: ["always", { allowNewlines: true }] | |
184 | }, | |
185 | { | |
186 | code: "var f = new Foo\n();", | |
187 | options: ["always", { allowNewlines: true }] | |
188 | }, | |
189 | { | |
190 | code: "f// comment\n()", | |
191 | options: ["always", { allowNewlines: true }] | |
192 | }, | |
193 | { | |
194 | code: "f // comment\n ()", | |
195 | options: ["always", { allowNewlines: true }] | |
196 | }, | |
197 | { | |
198 | code: "f\n/*\n*/\n()", | |
199 | options: ["always", { allowNewlines: true }] | |
200 | }, | |
201 | { | |
202 | code: "f\r();", | |
203 | options: ["always", { allowNewlines: true }] | |
204 | }, | |
205 | { | |
206 | code: "f\u2028();", | |
207 | options: ["always", { allowNewlines: true }] | |
208 | }, | |
209 | { | |
210 | code: "f\u2029();", | |
211 | options: ["always", { allowNewlines: true }] | |
212 | }, | |
213 | { | |
214 | code: "f\r\n();", | |
215 | options: ["always", { allowNewlines: true }] | |
216 | }, | |
217 | { | |
218 | code: "import\n(source)", | |
219 | options: ["always", { allowNewlines: true }], | |
220 | parserOptions: { ecmaVersion: 2020 } | |
221 | } | |
222 | ], | |
223 | invalid: [ | |
224 | ||
225 | // default ("never") | |
226 | { | |
227 | code: "f ();", | |
228 | output: "f();", | |
56c4a2cb | 229 | errors: [{ messageId: "unexpectedWhitespace", type: "CallExpression" }] |
eb39fafa DC |
230 | }, |
231 | { | |
232 | code: "f (a, b);", | |
233 | output: "f(a, b);", | |
56c4a2cb | 234 | errors: [{ messageId: "unexpectedWhitespace", type: "CallExpression" }] |
eb39fafa DC |
235 | }, |
236 | { | |
237 | code: "f.b ();", | |
238 | output: "f.b();", | |
56c4a2cb | 239 | errors: [{ messageId: "unexpectedWhitespace", type: "CallExpression", column: 3 }] |
eb39fafa DC |
240 | }, |
241 | { | |
242 | code: "f.b().c ();", | |
243 | output: "f.b().c();", | |
56c4a2cb | 244 | errors: [{ messageId: "unexpectedWhitespace", type: "CallExpression", column: 7 }] |
eb39fafa DC |
245 | }, |
246 | { | |
247 | code: "f() ()", | |
248 | output: "f()()", | |
56c4a2cb | 249 | errors: [{ messageId: "unexpectedWhitespace", type: "CallExpression" }] |
eb39fafa DC |
250 | }, |
251 | { | |
252 | code: "(function() {} ())", | |
253 | output: "(function() {}())", | |
56c4a2cb | 254 | errors: [{ messageId: "unexpectedWhitespace", type: "CallExpression" }] |
eb39fafa DC |
255 | }, |
256 | { | |
257 | code: "var f = new Foo ()", | |
258 | output: "var f = new Foo()", | |
56c4a2cb | 259 | errors: [{ messageId: "unexpectedWhitespace", type: "NewExpression" }] |
eb39fafa DC |
260 | }, |
261 | { | |
262 | code: "f ( (0) )", | |
263 | output: "f( (0) )", | |
56c4a2cb | 264 | errors: [{ messageId: "unexpectedWhitespace", type: "CallExpression" }] |
eb39fafa DC |
265 | }, |
266 | { | |
267 | code: "f(0) (1)", | |
268 | output: "f(0)(1)", | |
56c4a2cb | 269 | errors: [{ messageId: "unexpectedWhitespace", type: "CallExpression" }] |
eb39fafa DC |
270 | }, |
271 | { | |
272 | code: "(f) (0)", | |
273 | output: "(f)(0)", | |
56c4a2cb | 274 | errors: [{ messageId: "unexpectedWhitespace", type: "CallExpression" }] |
eb39fafa DC |
275 | }, |
276 | { | |
277 | code: "f ();\n t ();", | |
278 | output: "f();\n t();", | |
279 | errors: [ | |
56c4a2cb DC |
280 | { messageId: "unexpectedWhitespace", type: "CallExpression" }, |
281 | { messageId: "unexpectedWhitespace", type: "CallExpression" } | |
eb39fafa DC |
282 | ] |
283 | }, | |
284 | { | |
285 | code: "import (source);", | |
286 | output: "import(source);", | |
287 | parserOptions: { ecmaVersion: 2020 }, | |
56c4a2cb | 288 | errors: [{ messageId: "unexpectedWhitespace", type: "ImportExpression" }] |
eb39fafa DC |
289 | }, |
290 | ||
291 | // https://github.com/eslint/eslint/issues/7787 | |
292 | { | |
293 | code: "f\n();", | |
294 | output: null, // no change | |
56c4a2cb | 295 | errors: [{ messageId: "unexpectedWhitespace", type: "CallExpression" }] |
eb39fafa DC |
296 | }, |
297 | { | |
298 | code: "f\r();", | |
299 | output: null, // no change | |
56c4a2cb | 300 | errors: [{ messageId: "unexpectedWhitespace", type: "CallExpression" }] |
eb39fafa DC |
301 | }, |
302 | { | |
303 | code: "f\u2028();", | |
304 | output: null, // no change | |
56c4a2cb | 305 | errors: [{ messageId: "unexpectedWhitespace", type: "CallExpression" }] |
eb39fafa DC |
306 | }, |
307 | { | |
308 | code: "f\u2029();", | |
309 | output: null, // no change | |
56c4a2cb | 310 | errors: [{ messageId: "unexpectedWhitespace", type: "CallExpression" }] |
eb39fafa DC |
311 | }, |
312 | { | |
313 | code: "f\r\n();", | |
314 | output: null, // no change | |
56c4a2cb | 315 | errors: [{ messageId: "unexpectedWhitespace", type: "CallExpression" }] |
eb39fafa DC |
316 | }, |
317 | { | |
318 | code: "import\n(source);", | |
319 | output: null, | |
320 | parserOptions: { ecmaVersion: 2020 }, | |
56c4a2cb | 321 | errors: [{ messageId: "unexpectedWhitespace", type: "ImportExpression" }] |
eb39fafa DC |
322 | }, |
323 | ||
324 | // "never" | |
325 | { | |
326 | code: "f ();", | |
327 | output: "f();", | |
328 | options: ["never"], | |
56c4a2cb | 329 | errors: [{ messageId: "unexpectedWhitespace", type: "CallExpression" }] |
eb39fafa DC |
330 | }, |
331 | { | |
332 | code: "f (a, b);", | |
333 | output: "f(a, b);", | |
334 | options: ["never"], | |
56c4a2cb | 335 | errors: [{ messageId: "unexpectedWhitespace", type: "CallExpression" }] |
eb39fafa DC |
336 | }, |
337 | { | |
338 | code: "f.b ();", | |
339 | output: "f.b();", | |
340 | options: ["never"], | |
56c4a2cb | 341 | errors: [{ messageId: "unexpectedWhitespace", type: "CallExpression", column: 3 }] |
eb39fafa DC |
342 | }, |
343 | { | |
344 | code: "f.b().c ();", | |
345 | output: "f.b().c();", | |
346 | options: ["never"], | |
56c4a2cb | 347 | errors: [{ messageId: "unexpectedWhitespace", type: "CallExpression", column: 7 }] |
eb39fafa DC |
348 | }, |
349 | { | |
350 | code: "f() ()", | |
351 | output: "f()()", | |
352 | options: ["never"], | |
56c4a2cb | 353 | errors: [{ messageId: "unexpectedWhitespace", type: "CallExpression" }] |
eb39fafa DC |
354 | }, |
355 | { | |
356 | code: "(function() {} ())", | |
357 | output: "(function() {}())", | |
358 | options: ["never"], | |
56c4a2cb | 359 | errors: [{ messageId: "unexpectedWhitespace", type: "CallExpression" }] |
eb39fafa DC |
360 | }, |
361 | { | |
362 | code: "var f = new Foo ()", | |
363 | output: "var f = new Foo()", | |
364 | options: ["never"], | |
56c4a2cb | 365 | errors: [{ messageId: "unexpectedWhitespace", type: "NewExpression" }] |
eb39fafa DC |
366 | }, |
367 | { | |
368 | code: "f ( (0) )", | |
369 | output: "f( (0) )", | |
370 | options: ["never"], | |
56c4a2cb | 371 | errors: [{ messageId: "unexpectedWhitespace", type: "CallExpression" }] |
eb39fafa DC |
372 | }, |
373 | { | |
374 | code: "f(0) (1)", | |
375 | output: "f(0)(1)", | |
376 | options: ["never"], | |
56c4a2cb | 377 | errors: [{ messageId: "unexpectedWhitespace", type: "CallExpression" }] |
eb39fafa DC |
378 | }, |
379 | { | |
380 | code: "(f) (0)", | |
381 | output: "(f)(0)", | |
382 | options: ["never"], | |
56c4a2cb | 383 | errors: [{ messageId: "unexpectedWhitespace", type: "CallExpression" }] |
eb39fafa DC |
384 | }, |
385 | { | |
386 | code: "f ();\n t ();", | |
387 | output: "f();\n t();", | |
388 | options: ["never"], | |
389 | errors: [ | |
56c4a2cb DC |
390 | { messageId: "unexpectedWhitespace", type: "CallExpression" }, |
391 | { messageId: "unexpectedWhitespace", type: "CallExpression" } | |
eb39fafa DC |
392 | ] |
393 | }, | |
394 | { | |
395 | code: "import (source);", | |
396 | output: "import(source);", | |
397 | options: ["never"], | |
398 | parserOptions: { ecmaVersion: 2020 }, | |
56c4a2cb | 399 | errors: [{ messageId: "unexpectedWhitespace", type: "ImportExpression" }] |
eb39fafa DC |
400 | }, |
401 | ||
402 | // https://github.com/eslint/eslint/issues/7787 | |
403 | { | |
404 | code: "f\n();", | |
405 | output: null, // no change | |
406 | options: ["never"], | |
407 | errors: [ | |
408 | { | |
56c4a2cb | 409 | messageId: "unexpectedWhitespace", |
eb39fafa DC |
410 | type: "CallExpression" |
411 | } | |
412 | ] | |
413 | }, | |
414 | { | |
415 | code: [ | |
416 | "this.cancelled.add(request)", | |
417 | "this.decrement(request)", | |
418 | "(0, request.reject)(new api.Cancel())" | |
419 | ].join("\n"), | |
420 | output: null, // no change | |
421 | options: ["never"], | |
422 | errors: [ | |
423 | { | |
56c4a2cb | 424 | messageId: "unexpectedWhitespace", |
eb39fafa DC |
425 | type: "CallExpression", |
426 | line: 2, | |
427 | column: 23 | |
428 | } | |
429 | ] | |
430 | }, | |
431 | { | |
432 | code: [ | |
433 | "var a = foo", | |
434 | "(function(global) {}(this));" | |
435 | ].join("\n"), | |
436 | output: null, // no change | |
437 | options: ["never"], | |
438 | errors: [ | |
439 | { | |
56c4a2cb | 440 | messageId: "unexpectedWhitespace", |
eb39fafa DC |
441 | type: "CallExpression", |
442 | line: 1, | |
443 | column: 9 | |
444 | } | |
445 | ] | |
446 | }, | |
447 | { | |
448 | code: [ | |
449 | "var a = foo", | |
450 | "(0, baz())" | |
451 | ].join("\n"), | |
452 | output: null, // no change | |
453 | options: ["never"], | |
454 | errors: [ | |
455 | { | |
56c4a2cb | 456 | messageId: "unexpectedWhitespace", |
eb39fafa DC |
457 | type: "CallExpression", |
458 | line: 1, | |
459 | column: 9 | |
460 | } | |
461 | ] | |
462 | }, | |
463 | { | |
464 | code: "f\r();", | |
465 | output: null, // no change | |
466 | options: ["never"], | |
467 | errors: [ | |
468 | { | |
56c4a2cb | 469 | messageId: "unexpectedWhitespace", |
eb39fafa DC |
470 | type: "CallExpression" |
471 | } | |
472 | ] | |
473 | }, | |
474 | { | |
475 | code: "f\u2028();", | |
476 | output: null, // no change | |
477 | options: ["never"], | |
478 | errors: [ | |
479 | { | |
56c4a2cb | 480 | messageId: "unexpectedWhitespace", |
eb39fafa DC |
481 | type: "CallExpression" |
482 | } | |
483 | ] | |
484 | }, | |
485 | { | |
486 | code: "f\u2029();", | |
487 | output: null, // no change | |
488 | options: ["never"], | |
489 | errors: [ | |
490 | { | |
56c4a2cb | 491 | messageId: "unexpectedWhitespace", |
eb39fafa DC |
492 | type: "CallExpression" |
493 | } | |
494 | ] | |
495 | }, | |
496 | { | |
497 | code: "f\r\n();", | |
498 | output: null, // no change | |
499 | options: ["never"], | |
500 | errors: [ | |
501 | { | |
56c4a2cb | 502 | messageId: "unexpectedWhitespace", |
eb39fafa DC |
503 | type: "CallExpression" |
504 | } | |
505 | ] | |
506 | }, | |
507 | ||
508 | // "always" | |
509 | { | |
510 | code: "f();", | |
511 | output: "f ();", | |
512 | options: ["always"], | |
513 | errors: [{ messageId: "missing", type: "CallExpression" }] | |
514 | }, | |
515 | { | |
516 | code: "f\n();", | |
517 | output: "f ();", | |
518 | options: ["always"], | |
56c4a2cb | 519 | errors: [{ messageId: "unexpectedNewline", type: "CallExpression" }] |
eb39fafa DC |
520 | }, |
521 | { | |
522 | code: "f(a, b);", | |
523 | output: "f (a, b);", | |
524 | options: ["always"], | |
525 | errors: [{ messageId: "missing", type: "CallExpression" }] | |
526 | }, | |
527 | { | |
528 | code: "f\n(a, b);", | |
529 | output: "f (a, b);", | |
530 | options: ["always"], | |
56c4a2cb | 531 | errors: [{ messageId: "unexpectedNewline", type: "CallExpression" }] |
eb39fafa DC |
532 | }, |
533 | { | |
534 | code: "f.b();", | |
535 | output: "f.b ();", | |
536 | options: ["always"], | |
537 | errors: [{ messageId: "missing", type: "CallExpression", column: 3 }] | |
538 | }, | |
539 | { | |
540 | code: "f.b\n();", | |
541 | output: "f.b ();", | |
542 | options: ["always"], | |
56c4a2cb | 543 | errors: [{ messageId: "unexpectedNewline", type: "CallExpression", column: 3 }] |
eb39fafa DC |
544 | }, |
545 | { | |
546 | code: "f.b().c ();", | |
547 | output: "f.b ().c ();", | |
548 | options: ["always"], | |
549 | errors: [{ messageId: "missing", type: "CallExpression", column: 3 }] | |
550 | }, | |
551 | { | |
552 | code: "f.b\n().c ();", | |
553 | output: "f.b ().c ();", | |
554 | options: ["always"], | |
56c4a2cb | 555 | errors: [{ messageId: "unexpectedNewline", type: "CallExpression", column: 3 }] |
eb39fafa DC |
556 | }, |
557 | { | |
558 | code: "f() ()", | |
559 | output: "f () ()", | |
560 | options: ["always"], | |
561 | errors: [{ messageId: "missing", type: "CallExpression" }] | |
562 | }, | |
563 | { | |
564 | code: "f\n() ()", | |
565 | output: "f () ()", | |
566 | options: ["always"], | |
56c4a2cb | 567 | errors: [{ messageId: "unexpectedNewline", type: "CallExpression" }] |
eb39fafa DC |
568 | }, |
569 | { | |
570 | code: "f\n()()", | |
571 | output: "f () ()", | |
572 | options: ["always"], | |
573 | errors: [ | |
56c4a2cb | 574 | { messageId: "unexpectedNewline", type: "CallExpression" }, |
eb39fafa DC |
575 | { messageId: "missing", type: "CallExpression" } |
576 | ] | |
577 | }, | |
578 | { | |
579 | code: "(function() {}())", | |
580 | output: "(function() {} ())", | |
581 | options: ["always"], | |
582 | errors: [{ messageId: "missing", type: "CallExpression" }] | |
583 | }, | |
584 | { | |
585 | code: "var f = new Foo()", | |
586 | output: "var f = new Foo ()", | |
587 | options: ["always"], | |
588 | errors: [{ messageId: "missing", type: "NewExpression" }] | |
589 | }, | |
590 | { | |
591 | code: "f( (0) )", | |
592 | output: "f ( (0) )", | |
593 | options: ["always"], | |
594 | errors: [{ messageId: "missing", type: "CallExpression" }] | |
595 | }, | |
596 | { | |
597 | code: "f(0) (1)", | |
598 | output: "f (0) (1)", | |
599 | options: ["always"], | |
600 | errors: [{ messageId: "missing", type: "CallExpression" }] | |
601 | }, | |
602 | { | |
603 | code: "(f)(0)", | |
604 | output: "(f) (0)", | |
605 | options: ["always"], | |
606 | errors: [{ messageId: "missing", type: "CallExpression" }] | |
607 | }, | |
608 | { | |
609 | code: "import(source);", | |
610 | output: "import (source);", | |
611 | options: ["always"], | |
612 | parserOptions: { ecmaVersion: 2020 }, | |
613 | errors: [{ messageId: "missing", type: "ImportExpression" }] | |
614 | }, | |
615 | { | |
616 | code: "f();\n t();", | |
617 | output: "f ();\n t ();", | |
618 | options: ["always"], | |
619 | errors: [ | |
620 | { messageId: "missing", type: "CallExpression" }, | |
621 | { messageId: "missing", type: "CallExpression" } | |
622 | ] | |
623 | }, | |
624 | { | |
625 | code: "f\r();", | |
626 | output: "f ();", | |
627 | options: ["always"], | |
56c4a2cb | 628 | errors: [{ messageId: "unexpectedNewline", type: "CallExpression" }] |
eb39fafa DC |
629 | }, |
630 | { | |
631 | code: "f\u2028();", | |
632 | output: "f ();", | |
633 | options: ["always"], | |
56c4a2cb | 634 | errors: [{ messageId: "unexpectedNewline", type: "CallExpression" }] |
eb39fafa DC |
635 | }, |
636 | { | |
637 | code: "f\u2029();", | |
638 | output: "f ();", | |
639 | options: ["always"], | |
56c4a2cb | 640 | errors: [{ messageId: "unexpectedNewline", type: "CallExpression" }] |
eb39fafa DC |
641 | }, |
642 | { | |
643 | code: "f\r\n();", | |
644 | output: "f ();", | |
645 | options: ["always"], | |
56c4a2cb | 646 | errors: [{ messageId: "unexpectedNewline", type: "CallExpression" }] |
eb39fafa DC |
647 | }, |
648 | ||
649 | // "always", "allowNewlines": true | |
650 | { | |
651 | code: "f();", | |
652 | output: "f ();", | |
653 | options: ["always", { allowNewlines: true }], | |
654 | errors: [ | |
655 | { messageId: "missing", type: "CallExpression" }] | |
656 | }, | |
657 | { | |
658 | code: "f(a, b);", | |
659 | output: "f (a, b);", | |
660 | options: ["always", { allowNewlines: true }], | |
661 | errors: [{ messageId: "missing", type: "CallExpression" }] | |
662 | }, | |
663 | { | |
664 | code: "f.b();", | |
665 | output: "f.b ();", | |
666 | options: ["always", { allowNewlines: true }], | |
667 | errors: [{ messageId: "missing", type: "CallExpression", column: 3 }] | |
668 | }, | |
669 | { | |
670 | code: "f.b().c ();", | |
671 | output: "f.b ().c ();", | |
672 | options: ["always", { allowNewlines: true }], | |
673 | errors: [{ messageId: "missing", type: "CallExpression", column: 3 }] | |
674 | }, | |
675 | { | |
676 | code: "f() ()", | |
677 | output: "f () ()", | |
678 | options: ["always", { allowNewlines: true }], | |
679 | errors: [{ messageId: "missing", type: "CallExpression" }] | |
680 | }, | |
681 | { | |
682 | code: "(function() {}())", | |
683 | output: "(function() {} ())", | |
684 | options: ["always", { allowNewlines: true }], | |
685 | errors: [{ messageId: "missing", type: "CallExpression" }] | |
686 | }, | |
687 | { | |
688 | code: "var f = new Foo()", | |
689 | output: "var f = new Foo ()", | |
690 | options: ["always", { allowNewlines: true }], | |
691 | errors: [{ messageId: "missing", type: "NewExpression" }] | |
692 | }, | |
693 | { | |
694 | code: "f( (0) )", | |
695 | output: "f ( (0) )", | |
696 | options: ["always", { allowNewlines: true }], | |
697 | errors: [{ messageId: "missing", type: "CallExpression" }] | |
698 | }, | |
699 | { | |
700 | code: "f(0) (1)", | |
701 | output: "f (0) (1)", | |
702 | options: ["always", { allowNewlines: true }], | |
703 | errors: [{ messageId: "missing", type: "CallExpression" }] | |
704 | }, | |
705 | { | |
706 | code: "(f)(0)", | |
707 | output: "(f) (0)", | |
708 | options: ["always", { allowNewlines: true }], | |
709 | errors: [{ messageId: "missing", type: "CallExpression" }] | |
710 | }, | |
711 | { | |
712 | code: "f();\n t();", | |
713 | output: "f ();\n t ();", | |
714 | options: ["always", { allowNewlines: true }], | |
715 | errors: [ | |
716 | { messageId: "missing", type: "CallExpression" }, | |
717 | { messageId: "missing", type: "CallExpression" } | |
718 | ] | |
719 | } | |
720 | ] | |
721 | }); |