Skip to content

feat(unicorn): add prefer-array-last-methods rule - #2317

Merged
elecmonkey merged 10 commits into
web-infra-dev:mainfrom
HashemKhalifa:feat/unicorn-prefer-array-last-methods
Sep 28, 2026
Merged

elecmonkey merged 10 commits into
web-infra-dev:mainfrom
HashemKhalifa:feat/unicorn-prefer-array-last-methods

Conversation

@HashemKhalifa

@HashemKhalifa HashemKhalifa commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Motivation

Refs #1309. Port unicorn/prefer-array-last-methods from eslint-plugin-unicorn v75.0.0.

Implementation and tests

  • Native suggestion-only rule, complete Go upstream/docs/extras suites, and JS upstream mirror.
  • Tests-first checkpoint: 2f6c5c42.
  • The JS mirror applies the actual returned suggestion edits for all upstream invalid cases and compares exact messages and resulting source. It also verifies the absence of autofixes and the absence of suggestions for comment-guarded cases. These are executable checks, not suggestion fields ignored by the shared RuleTester.
  • Native registration and enablement in packages/rslint/src/config/presets/unicorn.ts; presets.test.ts is untouched.

Verification

  • Focused Go suite: passed; rule-package statement coverage: 100.0%.
  • Fresh focused native production build and core JS build: passed. Temporary native catalogs and test-runner configuration were restored byte-for-byte. Optional rule-option declaration generation was skipped because no schema dump was present.
  • Five selected JS integration files: 5 files / 13 groups passed; this file includes a real suggestion-output assertion group.
  • Deliberately corrupting an expected suggestion output fails the new runtime assertion; the mutation was restored.
  • Changed-file formatting and git diff --check: passed. The repository spelling command excludes these upstream fixture files.

Upstream GitHub Actions remains at action_required on the current head; these are local focused validation results, not a claim of green upstream CI.

@HashemKhalifa
HashemKhalifa marked this pull request as ready for review September 25, 2026 20:54
@HashemKhalifa
HashemKhalifa marked this pull request as draft September 25, 2026 21:05
Apply each returned suggestion and compare its message and exact output against the upstream specification. Assert no autofixes and no suggestions for the comment-guarded cases; keep the shared tester unchanged.
@HashemKhalifa
HashemKhalifa marked this pull request as ready for review September 26, 2026 11:09
@HashemKhalifa
HashemKhalifa marked this pull request as draft September 27, 2026 08:12
@HashemKhalifa
HashemKhalifa marked this pull request as ready for review September 28, 2026 07:53
@elecmonkey
elecmonkey enabled auto-merge (squash) September 28, 2026 08:28
@elecmonkey
elecmonkey merged commit c8bc531 into web-infra-dev:main Sep 28, 2026
15 checks passed
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.

2 participants