Commit 2b933a9
committed
fix(prefer-optional-chain): avoid access comparison false positive (#914)
Prevents `prefer-optional-chain` from reporting access-vs-access comparisons like `x && y && x.a === y.a`, where optional chaining would change when the other side is evaluated.
Adds a regression test for the valid guarded comparison case; fixes oxc-project/oxc#21849.1 parent f9cb483 commit 2b933a9
2 files changed
Lines changed: 15 additions & 14 deletions
Lines changed: 7 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1533 | 1533 | | |
1534 | 1534 | | |
1535 | 1535 | | |
1536 | | - | |
1537 | | - | |
| 1536 | + | |
| 1537 | + | |
| 1538 | + | |
1538 | 1539 | | |
1539 | | - | |
1540 | | - | |
1541 | | - | |
1542 | | - | |
1543 | | - | |
| 1540 | + | |
1544 | 1541 | | |
1545 | 1542 | | |
1546 | 1543 | | |
| |||
1578 | 1575 | | |
1579 | 1576 | | |
1580 | 1577 | | |
1581 | | - | |
1582 | | - | |
| 1578 | + | |
| 1579 | + | |
1583 | 1580 | | |
1584 | | - | |
1585 | | - | |
1586 | | - | |
1587 | | - | |
1588 | | - | |
| 1581 | + | |
1589 | 1582 | | |
1590 | 1583 | | |
1591 | 1584 | | |
| |||
Lines changed: 8 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1008 | 1008 | | |
1009 | 1009 | | |
1010 | 1010 | | |
| 1011 | + | |
| 1012 | + | |
| 1013 | + | |
| 1014 | + | |
| 1015 | + | |
| 1016 | + | |
| 1017 | + | |
| 1018 | + | |
1011 | 1019 | | |
1012 | 1020 | | |
1013 | 1021 | | |
| |||
0 commit comments