]>
git.proxmox.com Git - pve-eslint.git/blob - eslint/tests/lib/rules/yoda.js
2 * @fileoverview Tests for yoda rule.
3 * @author Raphael Pigulla
8 //------------------------------------------------------------------------------
10 //------------------------------------------------------------------------------
11 const rule
= require("../../../lib/rules/yoda"),
12 { RuleTester
} = require("../../../lib/rule-tester");
14 //------------------------------------------------------------------------------
16 //------------------------------------------------------------------------------
18 const ruleTester
= new RuleTester();
20 ruleTester
.run("yoda", rule
, {
24 { code
: "if (value === \"red\") {}", options
: ["never"] },
25 { code
: "if (value === value) {}", options
: ["never"] },
26 { code
: "if (value != 5) {}", options
: ["never"] },
27 { code
: "if (5 & foo) {}", options
: ["never"] },
28 { code
: "if (5 === 4) {}", options
: ["never"] },
29 { code
: "if (value === `red`) {}", options
: ["never"], parserOptions
: { ecmaVersion
: 2015 } },
30 { code
: "if (`red` === `red`) {}", options
: ["never"], parserOptions
: { ecmaVersion
: 2015 } },
31 { code
: "if (`${foo}` === `red`) {}", options
: ["never"], parserOptions
: { ecmaVersion
: 2015 } },
32 { code
: "if (`${\"\"}` === `red`) {}", options
: ["never"], parserOptions
: { ecmaVersion
: 2015 } },
33 { code
: "if (`${\"red\"}` === foo) {}", options
: ["never"], parserOptions
: { ecmaVersion
: 2015 } },
34 { code
: "if (b > `a` && b > `a`) {}", options
: ["never"], parserOptions
: { ecmaVersion
: 2015 } },
35 { code
: "if (`b` > `a` && \"b\" > \"a\") {}", options
: ["never"], parserOptions
: { ecmaVersion
: 2015 } },
38 { code
: "if (\"blue\" === value) {}", options
: ["always"] },
39 { code
: "if (value === value) {}", options
: ["always"] },
40 { code
: "if (4 != value) {}", options
: ["always"] },
41 { code
: "if (foo & 4) {}", options
: ["always"] },
42 { code
: "if (5 === 4) {}", options
: ["always"] },
43 { code
: "if (`red` === value) {}", options
: ["always"], parserOptions
: { ecmaVersion
: 2015 } },
44 { code
: "if (`red` === `red`) {}", options
: ["always"], parserOptions
: { ecmaVersion
: 2015 } },
45 { code
: "if (`red` === `${foo}`) {}", options
: ["always"], parserOptions
: { ecmaVersion
: 2015 } },
46 { code
: "if (`red` === `${\"\"}`) {}", options
: ["always"], parserOptions
: { ecmaVersion
: 2015 } },
47 { code
: "if (foo === `${\"red\"}`) {}", options
: ["always"], parserOptions
: { ecmaVersion
: 2015 } },
48 { code
: "if (`a` > b && `a` > b) {}", options
: ["always"], parserOptions
: { ecmaVersion
: 2015 } },
49 { code
: "if (`b` > `a` && \"b\" > \"a\") {}", options
: ["always"], parserOptions
: { ecmaVersion
: 2015 } },
53 code
: "if (0 < x && x <= 1) {}",
54 options
: ["never", { exceptRange
: true }]
56 code
: "if (x < 0 || 1 <= x) {}",
57 options
: ["never", { exceptRange
: true }]
59 code
: "if (0 <= x && x < 1) {}",
60 options
: ["always", { exceptRange
: true }]
62 code
: "if (x <= 'bar' || 'foo' < x) {}",
63 options
: ["always", { exceptRange
: true }]
65 code
: "if ('blue' < x.y && x.y < 'green') {}",
66 options
: ["never", { exceptRange
: true }]
68 code
: "if (0 < x[``] && x[``] < 100) {}",
69 options
: ["never", { exceptRange
: true }],
70 parserOptions
: { ecmaVersion
: 2015 }
72 code
: "if (0 < x[''] && x[``] < 100) {}",
73 options
: ["never", { exceptRange
: true }],
74 parserOptions
: { ecmaVersion
: 2015 }
76 code
: "if (0 <= x['y'] && x['y'] <= 100) {}",
77 options
: ["never", { exceptRange
: true }]
79 code
: "if (a < 0 && (0 < b && b < 1)) {}",
80 options
: ["never", { exceptRange
: true }]
82 code
: "if ((0 < a && a < 1) && b < 0) {}",
83 options
: ["never", { exceptRange
: true }]
85 code
: "if (a < 4 || (b[c[0]].d['e'] < 0 || 1 <= b[c[0]].d['e'])) {}",
86 options
: ["never", { exceptRange
: true }]
88 code
: "if (-1 < x && x < 0) {}",
89 options
: ["never", { exceptRange
: true }]
91 code
: "if (0 <= this.prop && this.prop <= 1) {}",
92 options
: ["never", { exceptRange
: true }]
94 code
: "if (0 <= index && index < list.length) {}",
95 options
: ["never", { exceptRange
: true }]
97 code
: "if (ZERO <= index && index < 100) {}",
98 options
: ["never", { exceptRange
: true }]
100 code
: "if (value <= MIN || 10 < value) {}",
101 options
: ["never", { exceptRange
: true }]
103 code
: "if (value <= 0 || MAX < value) {}",
104 options
: ["never", { exceptRange
: true }]
106 code
: "if (0 <= a.b && a[\"b\"] <= 100) {}",
107 options
: ["never", { exceptRange
: true }]
109 code
: "if (0 <= a.b && a[`b`] <= 100) {}",
110 options
: ["never", { exceptRange
: true }],
111 parserOptions
: { ecmaVersion
: 2015 }
113 code
: "if (-1n < x && x <= 1n) {}",
114 options
: ["never", { exceptRange
: true }],
115 parserOptions
: { ecmaVersion
: 2020 }
117 code
: "if (x < -1n || 1n <= x) {}",
118 options
: ["never", { exceptRange
: true }],
119 parserOptions
: { ecmaVersion
: 2020 }
121 code
: "if (-1n <= x && x < 1n) {}",
122 options
: ["always", { exceptRange
: true }],
123 parserOptions
: { ecmaVersion
: 2020 }
125 code
: "if (x < -1n || 1n <= x) {}",
126 options
: ["always", { exceptRange
: true }],
127 parserOptions
: { ecmaVersion
: 2020 }
129 code
: "if (x < `1` || `1` < x) {}",
130 options
: ["always", { exceptRange
: true }],
131 parserOptions
: { ecmaVersion
: 2020 }
133 code
: "if (1 <= a['/(?<zero>0)/'] && a[/(?<zero>0)/] <= 100) {}",
134 options
: ["never", { exceptRange
: true }],
135 parserOptions
: { ecmaVersion
: 2018 }
137 code
: "if (x <= `bar` || `foo` < x) {}",
138 options
: ["always", { exceptRange
: true }],
139 parserOptions
: { ecmaVersion
: 2015 }
141 code
: "if (`blue` < x.y && x.y < `green`) {}",
142 options
: ["never", { exceptRange
: true }],
143 parserOptions
: { ecmaVersion
: 2015 }
145 code
: "if (0 <= x[`y`] && x[`y`] <= 100) {}",
146 options
: ["never", { exceptRange
: true }],
147 parserOptions
: { ecmaVersion
: 2015 }
149 code
: "if (0 <= x[`y`] && x[\"y\"] <= 100) {}",
150 options
: ["never", { exceptRange
: true }],
151 parserOptions
: { ecmaVersion
: 2015 }
155 { code
: "if (0 < x && x <= 1) {}", options
: ["never", { onlyEquality
: true }] },
156 { code
: "if (x !== 'foo' && 'foo' !== x) {}", options
: ["never", { onlyEquality
: true }] },
157 { code
: "if (x < 2 && x !== -3) {}", options
: ["always", { onlyEquality
: true }] },
158 { code
: "if (x !== `foo` && `foo` !== x) {}", options
: ["never", { onlyEquality
: true }], parserOptions
: { ecmaVersion
: 2015 } },
159 { code
: "if (x < `2` && x !== `-3`) {}", options
: ["always", { onlyEquality
: true }], parserOptions
: { ecmaVersion
: 2015 } }
164 code
: "if (\"red\" == value) {}",
165 output
: "if (value == \"red\") {}",
169 messageId
: "expected",
170 data
: { expectedSide
: "right", operator
: "==" },
171 type
: "BinaryExpression"
176 code
: "if (true === value) {}",
177 output
: "if (value === true) {}",
181 messageId
: "expected",
182 data
: { expectedSide
: "right", operator
: "===" },
183 type
: "BinaryExpression"
188 code
: "if (5 != value) {}",
189 output
: "if (value != 5) {}",
193 messageId
: "expected",
194 data
: { expectedSide
: "right", operator
: "!=" },
195 type
: "BinaryExpression"
200 code
: "if (5n != value) {}",
201 output
: "if (value != 5n) {}",
203 parserOptions
: { ecmaVersion
: 2020 },
206 messageId
: "expected",
207 data
: { expectedSide
: "right", operator
: "!=" },
208 type
: "BinaryExpression"
213 code
: "if (null !== value) {}",
214 output
: "if (value !== null) {}",
218 messageId
: "expected",
219 data
: { expectedSide
: "right", operator
: "!==" },
220 type
: "BinaryExpression"
225 code
: "if (\"red\" <= value) {}",
226 output
: "if (value >= \"red\") {}",
230 messageId
: "expected",
231 data
: { expectedSide
: "right", operator
: "<=" },
232 type
: "BinaryExpression"
237 code
: "if (`red` <= value) {}",
238 output
: "if (value >= `red`) {}",
240 parserOptions
: { ecmaVersion
: 2015 },
243 messageId
: "expected",
244 data
: { expectedSide
: "right", operator
: "<=" },
245 type
: "BinaryExpression"
250 code
: "if (`red` <= `${foo}`) {}",
251 output
: "if (`${foo}` >= `red`) {}",
253 parserOptions
: { ecmaVersion
: 2015 },
256 messageId
: "expected",
257 data
: { expectedSide
: "right", operator
: "<=" },
258 type
: "BinaryExpression"
263 code
: "if (`red` <= `${\"red\"}`) {}",
264 output
: "if (`${\"red\"}` >= `red`) {}",
266 parserOptions
: { ecmaVersion
: 2015 },
269 messageId
: "expected",
270 data
: { expectedSide
: "right", operator
: "<=" },
271 type
: "BinaryExpression"
276 code
: "if (true >= value) {}",
277 output
: "if (value <= true) {}",
281 messageId
: "expected",
282 data
: { expectedSide
: "right", operator
: ">=" },
283 type
: "BinaryExpression"
288 code
: "var foo = (5 < value) ? true : false",
289 output
: "var foo = (value > 5) ? true : false",
293 messageId
: "expected",
294 data
: { expectedSide
: "right", operator
: "<" },
295 type
: "BinaryExpression"
300 code
: "function foo() { return (null > value); }",
301 output
: "function foo() { return (value < null); }",
305 messageId
: "expected",
306 data
: { expectedSide
: "right", operator
: ">" },
307 type
: "BinaryExpression"
312 code
: "if (-1 < str.indexOf(substr)) {}",
313 output
: "if (str.indexOf(substr) > -1) {}",
317 messageId
: "expected",
318 data
: { expectedSide
: "right", operator
: "<" },
319 type
: "BinaryExpression"
324 code
: "if (value == \"red\") {}",
325 output
: "if (\"red\" == value) {}",
329 messageId
: "expected",
330 data
: { expectedSide
: "left", operator
: "==" },
331 type
: "BinaryExpression"
336 code
: "if (value == `red`) {}",
337 output
: "if (`red` == value) {}",
339 parserOptions
: { ecmaVersion
: 2015 },
342 messageId
: "expected",
343 data
: { expectedSide
: "left", operator
: "==" },
344 type
: "BinaryExpression"
349 code
: "if (value === true) {}",
350 output
: "if (true === value) {}",
354 messageId
: "expected",
355 data
: { expectedSide
: "left", operator
: "===" },
356 type
: "BinaryExpression"
361 code
: "if (value === 5n) {}",
362 output
: "if (5n === value) {}",
364 parserOptions
: { ecmaVersion
: 2020 },
367 messageId
: "expected",
368 data
: { expectedSide
: "left", operator
: "===" },
369 type
: "BinaryExpression"
374 code
: "if (`${\"red\"}` <= `red`) {}",
375 output
: "if (`red` >= `${\"red\"}`) {}",
377 parserOptions
: { ecmaVersion
: 2015 },
380 messageId
: "expected",
381 data
: { expectedSide
: "left", operator
: "<=" },
382 type
: "BinaryExpression"
387 code
: "if (a < 0 && 0 <= b && b < 1) {}",
388 output
: "if (a < 0 && b >= 0 && b < 1) {}",
389 options
: ["never", { exceptRange
: true }],
392 messageId
: "expected",
393 data
: { expectedSide
: "right", operator
: "<=" },
394 type
: "BinaryExpression"
399 code
: "if (0 <= a && a < 1 && b < 1) {}",
400 output
: "if (a >= 0 && a < 1 && b < 1) {}",
401 options
: ["never", { exceptRange
: true }],
404 messageId
: "expected",
405 data
: { expectedSide
: "right", operator
: "<=" },
406 type
: "BinaryExpression"
411 code
: "if (1 < a && a < 0) {}",
412 output
: "if (a > 1 && a < 0) {}",
413 options
: ["never", { exceptRange
: true }],
416 messageId
: "expected",
417 data
: { expectedSide
: "right", operator
: "<" },
418 type
: "BinaryExpression"
423 code
: "0 < a && a < 1",
424 output
: "a > 0 && a < 1",
425 options
: ["never", { exceptRange
: true }],
428 messageId
: "expected",
429 data
: { expectedSide
: "right", operator
: "<" },
430 type
: "BinaryExpression"
435 code
: "var a = b < 0 || 1 <= b;",
436 output
: "var a = b < 0 || b >= 1;",
437 options
: ["never", { exceptRange
: true }],
440 messageId
: "expected",
441 data
: { expectedSide
: "right", operator
: "<=" },
442 type
: "BinaryExpression"
447 code
: "if (0 <= x && x < -1) {}",
448 output
: "if (x >= 0 && x < -1) {}",
449 options
: ["never", { exceptRange
: true }],
452 messageId
: "expected",
453 data
: { expectedSide
: "right", operator
: "<=" },
454 type
: "BinaryExpression"
459 code
: "var a = (b < 0 && 0 <= b);",
460 output
: "var a = (0 > b && 0 <= b);",
461 options
: ["always", { exceptRange
: true }],
464 messageId
: "expected",
465 data
: { expectedSide
: "left", operator
: "<" },
466 type
: "BinaryExpression"
471 code
: "var a = (b < `0` && `0` <= b);",
472 output
: "var a = (`0` > b && `0` <= b);",
473 options
: ["always", { exceptRange
: true }],
474 parserOptions
: { ecmaVersion
: 2015 },
477 messageId
: "expected",
478 data
: { expectedSide
: "left", operator
: "<" },
479 type
: "BinaryExpression"
484 code
: "if (0 <= a[b] && a['b'] < 1) {}",
485 output
: "if (a[b] >= 0 && a['b'] < 1) {}",
486 options
: ["never", { exceptRange
: true }],
489 messageId
: "expected",
490 data
: { expectedSide
: "right", operator
: "<=" },
491 type
: "BinaryExpression"
496 code
: "if (0 <= a[b] && a[`b`] < 1) {}",
497 output
: "if (a[b] >= 0 && a[`b`] < 1) {}",
498 options
: ["never", { exceptRange
: true }],
499 parserOptions
: { ecmaVersion
: 2015 },
502 messageId
: "expected",
503 data
: { expectedSide
: "right", operator
: "<=" },
504 type
: "BinaryExpression"
509 code
: "if (`0` <= a[b] && a[`b`] < `1`) {}",
510 output
: "if (a[b] >= `0` && a[`b`] < `1`) {}",
511 options
: ["never", { exceptRange
: true }],
512 parserOptions
: { ecmaVersion
: 2015 },
515 messageId
: "expected",
516 data
: { expectedSide
: "right", operator
: "<=" },
517 type
: "BinaryExpression"
522 code
: "if (0 <= a[b] && a.b < 1) {}",
523 output
: "if (a[b] >= 0 && a.b < 1) {}",
524 options
: ["never", { exceptRange
: true }],
527 messageId
: "expected",
528 data
: { expectedSide
: "right", operator
: "<=" },
529 type
: "BinaryExpression"
534 code
: "if (0 <= a[''] && a.b < 1) {}",
535 output
: "if (a[''] >= 0 && a.b < 1) {}",
536 options
: ["never", { exceptRange
: true }],
539 messageId
: "expected",
540 data
: { expectedSide
: "right", operator
: "<=" },
541 type
: "BinaryExpression"
546 code
: "if (0 <= a[''] && a[' '] < 1) {}",
547 output
: "if (a[''] >= 0 && a[' '] < 1) {}",
548 options
: ["never", { exceptRange
: true }],
551 messageId
: "expected",
552 data
: { expectedSide
: "right", operator
: "<=" },
553 type
: "BinaryExpression"
558 code
: "if (0 <= a[''] && a[null] < 1) {}",
559 output
: "if (a[''] >= 0 && a[null] < 1) {}",
560 options
: ["never", { exceptRange
: true }],
563 messageId
: "expected",
564 data
: { expectedSide
: "right", operator
: "<=" },
565 type
: "BinaryExpression"
570 code
: "if (0 <= a[``] && a[null] < 1) {}",
571 output
: "if (a[``] >= 0 && a[null] < 1) {}",
572 options
: ["never", { exceptRange
: true }],
573 parserOptions
: { ecmaVersion
: 2015 },
576 messageId
: "expected",
577 data
: { expectedSide
: "right", operator
: "<=" },
578 type
: "BinaryExpression"
583 code
: "if (0 <= a[''] && a[b] < 1) {}",
584 output
: "if (a[''] >= 0 && a[b] < 1) {}",
585 options
: ["never", { exceptRange
: true }],
588 messageId
: "expected",
589 data
: { expectedSide
: "right", operator
: "<=" },
590 type
: "BinaryExpression"
595 code
: "if (0 <= a[''] && a[b()] < 1) {}",
596 output
: "if (a[''] >= 0 && a[b()] < 1) {}",
597 options
: ["never", { exceptRange
: true }],
600 messageId
: "expected",
601 data
: { expectedSide
: "right", operator
: "<=" },
602 type
: "BinaryExpression"
607 code
: "if (0 <= a[``] && a[b()] < 1) {}",
608 output
: "if (a[``] >= 0 && a[b()] < 1) {}",
609 options
: ["never", { exceptRange
: true }],
610 parserOptions
: { ecmaVersion
: 2015 },
613 messageId
: "expected",
614 data
: { expectedSide
: "right", operator
: "<=" },
615 type
: "BinaryExpression"
620 code
: "if (0 <= a[b()] && a[b()] < 1) {}",
621 output
: "if (a[b()] >= 0 && a[b()] < 1) {}",
622 options
: ["never", { exceptRange
: true }],
625 messageId
: "expected",
626 data
: { expectedSide
: "right", operator
: "<=" },
627 type
: "BinaryExpression"
632 code
: "if (0 <= a.null && a[/(?<zero>0)/] <= 1) {}",
633 output
: "if (a.null >= 0 && a[/(?<zero>0)/] <= 1) {}",
634 options
: ["never", { exceptRange
: true }],
635 parserOptions
: { ecmaVersion
: 2018 },
638 messageId
: "expected",
639 data
: { expectedSide
: "right", operator
: "<=" },
640 type
: "BinaryExpression"
645 code
: "if (`green` < x.y && x.y < `blue`) {}",
646 output
: "if (x.y > `green` && x.y < `blue`) {}",
647 options
: ["never", { exceptRange
: true }],
648 parserOptions
: { ecmaVersion
: 2015 },
651 messageId
: "expected",
652 data
: { expectedSide
: "right", operator
: "<" },
653 type
: "BinaryExpression"
658 code
: "if (3 == a) {}",
659 output
: "if (a == 3) {}",
660 options
: ["never", { onlyEquality
: true }],
663 messageId
: "expected",
664 data
: { expectedSide
: "right", operator
: "==" },
665 type
: "BinaryExpression"
670 code
: "foo(3 === a);",
671 output
: "foo(a === 3);",
672 options
: ["never", { onlyEquality
: true }],
675 messageId
: "expected",
676 data
: { expectedSide
: "right", operator
: "===" },
677 type
: "BinaryExpression"
682 code
: "foo(a === 3);",
683 output
: "foo(3 === a);",
684 options
: ["always", { onlyEquality
: true }],
687 messageId
: "expected",
688 data
: { expectedSide
: "left", operator
: "===" },
689 type
: "BinaryExpression"
694 code
: "foo(a === `3`);",
695 output
: "foo(`3` === a);",
696 options
: ["always", { onlyEquality
: true }],
697 parserOptions
: { ecmaVersion
: 2015 },
700 messageId
: "expected",
701 data
: { expectedSide
: "left", operator
: "===" },
702 type
: "BinaryExpression"
707 code
: "if (0 <= x && x < 1) {}",
708 output
: "if (x >= 0 && x < 1) {}",
711 messageId
: "expected",
712 data
: { expectedSide
: "right", operator
: "<=" },
713 type
: "BinaryExpression"
718 code
: "if ( /* a */ 0 /* b */ < /* c */ foo /* d */ ) {}",
719 output
: "if ( /* a */ foo /* b */ > /* c */ 0 /* d */ ) {}",
723 messageId
: "expected",
724 data
: { expectedSide
: "right", operator
: "<" },
725 type
: "BinaryExpression"
730 code
: "if ( /* a */ foo /* b */ > /* c */ 0 /* d */ ) {}",
731 output
: "if ( /* a */ 0 /* b */ < /* c */ foo /* d */ ) {}",
735 messageId
: "expected",
736 data
: { expectedSide
: "left", operator
: ">" },
737 type
: "BinaryExpression"
742 code
: "if (foo()===1) {}",
743 output
: "if (1===foo()) {}",
747 messageId
: "expected",
748 data
: { expectedSide
: "left", operator
: "===" },
749 type
: "BinaryExpression"
754 code
: "if (foo() === 1) {}",
755 output
: "if (1 === foo()) {}",
759 messageId
: "expected",
760 data
: { expectedSide
: "left", operator
: "===" },
761 type
: "BinaryExpression"
766 // https://github.com/eslint/eslint/issues/7326
768 code
: "while (0 === (a));",
769 output
: "while ((a) === 0);",
773 messageId
: "expected",
774 data
: { expectedSide
: "right", operator
: "===" },
775 type
: "BinaryExpression"
780 code
: "while (0 === (a = b));",
781 output
: "while ((a = b) === 0);",
785 messageId
: "expected",
786 data
: { expectedSide
: "right", operator
: "===" },
787 type
: "BinaryExpression"
792 code
: "while ((a) === 0);",
793 output
: "while (0 === (a));",
797 messageId
: "expected",
798 data
: { expectedSide
: "left", operator
: "===" },
799 type
: "BinaryExpression"
804 code
: "while ((a = b) === 0);",
805 output
: "while (0 === (a = b));",
809 messageId
: "expected",
810 data
: { expectedSide
: "left", operator
: "===" },
811 type
: "BinaryExpression"
816 code
: "if (((((((((((foo)))))))))) === ((((((5)))))));",
817 output
: "if (((((((5)))))) === ((((((((((foo)))))))))));",
821 messageId
: "expected",
822 data
: { expectedSide
: "left", operator
: "===" },
823 type
: "BinaryExpression"
828 // Adjacent tokens tests
830 code
: "function *foo() { yield(1) < a }",
831 output
: "function *foo() { yield a > (1) }",
833 parserOptions
: { ecmaVersion
: 2015 },
836 messageId
: "expected",
837 data
: { expectedSide
: "right", operator
: "<" },
838 type
: "BinaryExpression"
843 code
: "function *foo() { yield((1)) < a }",
844 output
: "function *foo() { yield a > ((1)) }",
846 parserOptions
: { ecmaVersion
: 2015 },
849 messageId
: "expected",
850 data
: { expectedSide
: "right", operator
: "<" },
851 type
: "BinaryExpression"
856 code
: "function *foo() { yield 1 < a }",
857 output
: "function *foo() { yield a > 1 }",
859 parserOptions
: { ecmaVersion
: 2015 },
862 messageId
: "expected",
863 data
: { expectedSide
: "right", operator
: "<" },
864 type
: "BinaryExpression"
869 code
: "function *foo() { yield/**/1 < a }",
870 output
: "function *foo() { yield/**/a > 1 }",
872 parserOptions
: { ecmaVersion
: 2015 },
875 messageId
: "expected",
876 data
: { expectedSide
: "right", operator
: "<" },
877 type
: "BinaryExpression"
882 code
: "function *foo() { yield(1) < ++a }",
883 output
: "function *foo() { yield++a > (1) }",
885 parserOptions
: { ecmaVersion
: 2015 },
888 messageId
: "expected",
889 data
: { expectedSide
: "right", operator
: "<" },
890 type
: "BinaryExpression"
895 code
: "function *foo() { yield(1) < (a) }",
896 output
: "function *foo() { yield(a) > (1) }",
898 parserOptions
: { ecmaVersion
: 2015 },
901 messageId
: "expected",
902 data
: { expectedSide
: "right", operator
: "<" },
903 type
: "BinaryExpression"
913 messageId
: "expected",
914 data
: { expectedSide
: "right", operator
: "<" },
915 type
: "BinaryExpression"
920 code
: "function *foo() { yield++a < 1 }",
921 output
: "function *foo() { yield 1 > ++a }",
923 parserOptions
: { ecmaVersion
: 2015 },
926 messageId
: "expected",
927 data
: { expectedSide
: "left", operator
: "<" },
928 type
: "BinaryExpression"
933 code
: "function *foo() { yield(a) < 1 }",
934 output
: "function *foo() { yield 1 > (a) }",
936 parserOptions
: { ecmaVersion
: 2015 },
939 messageId
: "expected",
940 data
: { expectedSide
: "left", operator
: "<" },
941 type
: "BinaryExpression"
946 code
: "function *foo() { yield a < 1 }",
947 output
: "function *foo() { yield 1 > a }",
949 parserOptions
: { ecmaVersion
: 2015 },
952 messageId
: "expected",
953 data
: { expectedSide
: "left", operator
: "<" },
954 type
: "BinaryExpression"
959 code
: "function *foo() { yield/**/a < 1 }",
960 output
: "function *foo() { yield/**/1 > a }",
962 parserOptions
: { ecmaVersion
: 2015 },
965 messageId
: "expected",
966 data
: { expectedSide
: "left", operator
: "<" },
967 type
: "BinaryExpression"
972 code
: "function *foo() { yield++a < (1) }",
973 output
: "function *foo() { yield(1) > ++a }",
975 parserOptions
: { ecmaVersion
: 2015 },
978 messageId
: "expected",
979 data
: { expectedSide
: "left", operator
: "<" },
980 type
: "BinaryExpression"
990 messageId
: "expected",
991 data
: { expectedSide
: "left", operator
: "<" },
992 type
: "BinaryExpression"