Skip to content

Ratchet unicorn/prefer-short-arrow-method to error#285

Merged
twschiller merged 1 commit into
mainfrom
ratchet-unicorn-style-batch
Jun 22, 2026
Merged

Ratchet unicorn/prefer-short-arrow-method to error#285
twschiller merged 1 commit into
mainfrom
ratchet-unicorn-style-batch

Conversation

@twschiller

Copy link
Copy Markdown
Contributor

Sixth ratchet from #279.

This phase targeted the "trivial style batch" (prefer-short-arrow-method, prefer-minimal-ternary, prefer-iterator-to-array), but only one turned out to be cleanly ratchetable — the other two are documented as warnings rather than forced.

Ratcheted: prefer-short-arrow-method (1 site)

  • irrelevant-sections-redact.test.ts — a subscribe() { return () => {…} } method-with-single-return in a jest.mock factory, rewritten as an arrow property.

Kept as warnings (reasons in eslint.config.js + #279)

  • prefer-minimal-ternary — 2 of 3 sites rewrite cleanly, but confirmshame-sanitize's instanceof-narrowed ternary is a trilemma: the factored (cond ? f : g)(x) form widens the argument and breaks narrowing (typecheck error), while an if/else trips unicorn/prefer-ternary. Only a disable would satisfy it, so not worth forcing.
  • prefer-iterator-to-array — runtime supports Iterator#toArray() (Chrome 148 / Node 24), but it isn't typed under the current lib: ES2023; enabling it needs esnext.iterator added to tsconfig — a separate decision, not a ratchet.

Verification

  • bun run typecheck clean
  • bun run check exit 0 (rule now errors; 0 violations)
  • bun run test — 2059/2059 pass

Refs #279

Sixth ratchet from #279. One site — a method-with-single-return in a
jest.mock factory rewritten as an arrow property.

The other two "trivial" candidates in this phase stay warnings, with the
reasons recorded in eslint.config.js + #279:
- prefer-minimal-ternary: confirmshame-sanitize's instanceof-narrowed
  ternary can't satisfy it without breaking narrowing (factored call) or
  tripping prefer-ternary (if/else) — would need a disable.
- prefer-iterator-to-array: runtime supports Iterator#toArray() at our
  Chrome 148 / Node 24 targets, but it isn't typed under the ES2023 lib;
  enabling needs esnext.iterator in tsconfig — a separate decision.

Refs #279

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@vercel

vercel Bot commented Jun 22, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
agent-browser-shield-demo-site Ready Ready Preview, Comment Jun 22, 2026 12:03pm

Request Review

@twschiller twschiller merged commit 00296ad into main Jun 22, 2026
7 checks passed
@twschiller twschiller deleted the ratchet-unicorn-style-batch branch June 22, 2026 12:05
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.

1 participant