Ratchet unicorn/prefer-short-arrow-method to error#285
Merged
Conversation
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>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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— asubscribe() { return () => {…} }method-with-single-return in ajest.mockfactory, rewritten as an arrow property.Kept as warnings (reasons in
eslint.config.js+ #279)prefer-minimal-ternary— 2 of 3 sites rewrite cleanly, butconfirmshame-sanitize'sinstanceof-narrowed ternary is a trilemma: the factored(cond ? f : g)(x)form widens the argument and breaks narrowing (typecheck error), while anif/elsetripsunicorn/prefer-ternary. Only a disable would satisfy it, so not worth forcing.prefer-iterator-to-array— runtime supportsIterator#toArray()(Chrome 148 / Node 24), but it isn't typed under the currentlib: ES2023; enabling it needsesnext.iteratoradded to tsconfig — a separate decision, not a ratchet.Verification
bun run typecheckcleanbun run checkexit 0 (rule now errors; 0 violations)bun run test— 2059/2059 passRefs #279