Skip to content

fix(linter/unicorn): do not report on optionals in prefer-array-flat-map#21082

Merged
camc314 merged 1 commit intooxc-project:mainfrom
baevm:prefer-array-flat-map-fix-optionals
Apr 6, 2026
Merged

fix(linter/unicorn): do not report on optionals in prefer-array-flat-map#21082
camc314 merged 1 commit intooxc-project:mainfrom
baevm:prefer-array-flat-map-fix-optionals

Conversation

@baevm
Copy link
Copy Markdown
Contributor

@baevm baevm commented Apr 6, 2026

fixes commented out tests for optionals in #19428

@baevm baevm requested a review from camc314 as a code owner April 6, 2026 08:27
Copilot AI review requested due to automatic review settings April 6, 2026 08:27
@github-actions github-actions bot added A-linter Area - Linter C-bug Category - Bug labels Apr 6, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the Unicorn prefer-array-flat-map rule to avoid reporting (and therefore auto-fixing) map().flat() patterns when optional chaining is involved, re-enabling previously skipped upstream test cases.

Changes:

  • Skip diagnostics when the outer .flat() call is an optional call (.flat?.() / ?.flat()).
  • Skip diagnostics when the .flat member access is optionally chained (?.flat).
  • Skip diagnostics when the inner .map call is an optional call (map?.(…)), and re-enable the associated pass tests.

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Apr 6, 2026

Merging this PR will not alter performance

✅ 4 untouched benchmarks
⏩ 47 skipped benchmarks1


Comparing baevm:prefer-array-flat-map-fix-optionals (7e31434) with main (2484e3e)2

Open in CodSpeed

Footnotes

  1. 47 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

  2. No successful run was found on main (7ac69fa) during the generation of this report, so 2484e3e was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@camc314 camc314 merged commit 8be4de7 into oxc-project:main Apr 6, 2026
30 of 31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-linter Area - Linter C-bug Category - Bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants