Skip to content

fix: handle optional chaining and multiple expressions#87

Merged
43081j merged 2 commits intomainfrom
parenthessential-fudgery
Mar 22, 2026
Merged

fix: handle optional chaining and multiple expressions#87
43081j merged 2 commits intomainfrom
parenthessential-fudgery

Conversation

@43081j
Copy link
Copy Markdown
Contributor

@43081j 43081j commented Mar 21, 2026

In spliced/sorted/reversed rules, we need to parenthesise expressions
which have multiple childre, and need to retain optional chaining.

For example:

  • arr?.slice().reverse() -> arr?.toReversed()
  • (a ?? b).slice().reverse() -> (a ?? b).toReversed()

Fixes #82.

43081j added 2 commits March 21, 2026 18:12
In spliced/sorted/reversed rules, we need to parenthesise expressions
which have multiple childre, and need to retain optional chaining.

For example:

- `arr?.slice().reverse()` -> `arr?.toReversed()`
- `(a ?? b).slice().reverse()` -> `(a ?? b).toReversed()`

Fixes #82.
@43081j 43081j merged commit 8772528 into main Mar 22, 2026
3 checks passed
@43081j 43081j deleted the parenthessential-fudgery branch March 22, 2026 03:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(prefer-array-to-sorted/reversed/spliced): fixer breaks ?? precedence and drops optional chaining

1 participant