Consistent readable patterns

Apply consistent, type-safe idioms and keep logic/formatting easy to scan. - Prefer the established guard/pattern style: ```ts // preferred if the surrounding code uses boolean guards

copy reviewer prompt

Prompt

Reviewer Prompt

Apply consistent, type-safe idioms and keep logic/formatting easy to scan.

  • Prefer the established guard/pattern style:
    // preferred if the surrounding code uses boolean guards
    theme && devtools.setTheme(theme)
    
  • Remove redundant casts like as any when TypeScript can infer/narrow:
    const options = query.options // avoid unnecessary `as any`
    
  • Extract and reuse common “value or function” handling instead of repeating typeof ... === 'function' checks; use shared helpers (e.g., a resolveValueOrFunction utility) across the codebase.
  • Keep control flow structured: avoid duplicated assignments/notifications and hard-to-follow early returns. Split logic by the primary conditions (e.g., index change vs result change), then assign/notify accordingly.
  • Enforce consistent formatting/import conventions (grouping, ordering, quote style) to reduce diff noise and improve readability.

Use these guidelines to guide refactors during reviews, not only new code.

Source discussions