Skip to content

chore: name useRef values with a Ref suffix and enforce via ESLint - #2912

Merged
kodiakhq[bot] merged 2 commits into
mainfrom
brandon/brandon-eslint-ref-name-mechanical
Aug 14, 2026
Merged

chore: name useRef values with a Ref suffix and enforce via ESLint#2912
kodiakhq[bot] merged 2 commits into
mainfrom
brandon/brandon-eslint-ref-name-mechanical

Conversation

@brandon-pereira

Copy link
Copy Markdown
Member

What

Renames the 10 useRef values flagged by @eslint-react/naming-convention/ref-name to end in Ref, then promotes the rule to error so the convention holds going forward.

File Refs renamed
DOMPlayer.tsx wrapper, playerContainer, replayer, initialEvents, setLastEventTsLoaded*Ref
DBEditTimeChartForm/EditTimeChartForm.tsx subFormDirty, autoRunFired*Ref
hooks/useMetadata.tsx settingsAppliedsettingsAppliedRef
sessions.ts lastAbortControllerlastAbortControllerRef
utils.ts observerobserverInstanceRef

Why

Consistent Ref naming makes ref values obvious at a glance. This is the next mechanical batch in the ongoing lint-warning cleanup (follows #2903 and #2911).

Notes

  • In utils.ts, the intersection-observer hook already had an observerRef callback ref, so the useRef was renamed to observerInstanceRef to avoid a redeclaration collision (rather than the mechanical observerRef).
  • DOMPlayer.tsx's diff is larger only because replayer had 39 usages — all pure renames. styles.playerContainer (a CSS class) was deliberately left untouched.

Enforcement

  • @eslint-react/naming-convention/ref-nameerror
  • App --max-warnings lowered 601 → 590

Verification

  • yarn lint (app) — pass (0 errors; rule now enforced as error)
  • tsc --noEmit (app) — clean
  • yarn knip — clean
  • yarn ci:unit174 suites / 2898 tests pass

Behavior is unchanged. Changeset included (@hyperdx/app patch).

Rename the 10 refs flagged by @eslint-react/naming-convention/ref-name to end
in `Ref` (in DOMPlayer, EditTimeChartForm, useMetadata, sessions, and utils),
then promote the rule to error and lower the app --max-warnings ceiling.

The utils.ts intersection-observer hook already had an `observerRef` callback,
so its useRef was renamed to `observerInstanceRef` to avoid a collision.

Behavior is unchanged: 2898 unit tests pass, tsc and knip are clean.
@changeset-bot

changeset-bot Bot commented Aug 14, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: b740c49

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@hyperdx/app Patch
@hyperdx/api Patch
@hyperdx/otel-collector Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel

vercel Bot commented Aug 14, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
hyperdx-oss Ready Ready Preview Aug 14, 2026 6:24pm
hyperdx-storybook Ready Ready Preview Aug 14, 2026 6:24pm

Request Review

@github-actions github-actions Bot added the review/tier-2 Low risk — AI review + quick human skim label Aug 14, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔵 Tier 2 — Low Risk

Small, isolated change with no API route or data model modifications.

Why this tier:

  • Standard feature/fix — introduces new logic or modifies core functionality

Review process: AI review + quick human skim (target: 5–15 min). Reviewer validates AI assessment and checks for domain-specific concerns.
SLA: Resolve within 4 business hours.

Stats
  • Production files changed: 7
  • Production lines changed: 162
  • Branch: brandon/brandon-eslint-ref-name-mechanical
  • Author: brandon-pereira

To override this classification, remove the review/tier-2 label and apply a different review/tier-* label. Manual overrides are preserved on subsequent pushes.

@github-actions

Copy link
Copy Markdown
Contributor

Deep Review

✅ No critical issues found.

This is a purely mechanical rename of 10 useRef values to a *Ref suffix, plus promoting @eslint-react/naming-convention/ref-name to error and lowering the app --max-warnings ceiling (601 → 590). Verification against the diff (git diff b72ede0d^ b72ede0d) confirms the change is behavior-preserving:

  • All renamed identifiers are updated consistently at every usage site, including useCallback/useEffect dependency-array references (e.g. [replayer][replayerRef]). No old name is left dangling.
  • The only remaining pre-rename token, styles.playerContainer in packages/app/src/DOMPlayer.tsx, is a CSS-class member access and was correctly left untouched.
  • In packages/app/src/utils.ts, observer was renamed to observerInstanceRef (not observerRef) to avoid colliding with the existing observerRef callback ref, which remains intact and exported unchanged.
  • Ref identities are stable across renders, so the dependency arrays that list ref objects are unaffected by the rename — no effect re-run semantics change.
  • A changeset (.changeset/eslint-ref-name.md, @hyperdx/app patch) is included and correctly formatted.

No P0/P1, P2, or P3 findings meet the reporting bar — the remaining candidates (the 11-vs-10 gap between the warning-ceiling reduction and refs renamed, which reflects the rule promotion; and the deliberate observerInstanceRef naming asymmetry) are pure style observations with no behavioral impact and no missing-test implication, so they are dropped per the default-down rule.


Reviewers (5): correctness, kieran-typescript, maintainability, testing, project-standards.

Testing gaps: None — a behavior-preserving rename adds no new behavior to cover; the existing suite (per the author, 174 suites / 2898 tests) exercises the renamed code paths unchanged.

@greptile-apps

greptile-apps Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR standardizes React ref variable names and enforces the convention through ESLint without changing runtime behavior.

  • Renames ten useRef bindings and their usages to use a Ref suffix.
  • Promotes @eslint-react/naming-convention/ref-name to an error.
  • Lowers the app lint warning ceiling and adds a patch changeset.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
packages/app/eslint.config.mjs Promotes the ref naming convention to an ESLint error.
packages/app/package.json Lowers the permitted lint warning count to reflect the warnings removed by this change.
packages/app/src/DOMPlayer.tsx Consistently renames five replay-related refs without altering their identities or behavior.
packages/app/src/components/DBEditTimeChartForm/EditTimeChartForm.tsx Consistently renames dirty-state and auto-run refs without changing form behavior.
packages/app/src/hooks/useMetadata.tsx Renames the settings-applied ref consistently across its reset and application paths.
packages/app/src/sessions.ts Renames the abort-controller ref consistently across request creation and cancellation.
packages/app/src/utils.ts Renames the IntersectionObserver instance ref while preserving the distinct callback-ref API.

Reviews (2): Last reviewed commit: "Merge branch 'main' into brandon/brandon..." | Re-trigger Greptile

@brandon-pereira
brandon-pereira requested review from a team and pulpdrew and removed request for a team August 14, 2026 15:52
@github-actions

github-actions Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

E2E Test Results

All tests passed • 292 passed • 1 skipped • 843s

Status Count
✅ Passed 292
❌ Failed 0
⚠️ Flaky 2
⏭️ Skipped 1

Tests ran across 4 shards in parallel.

View full report →

@kodiakhq
kodiakhq Bot merged commit 9072973 into main Aug 14, 2026
27 checks passed
@kodiakhq
kodiakhq Bot deleted the brandon/brandon-eslint-ref-name-mechanical branch August 14, 2026 18:27
kodiakhq Bot pushed a commit that referenced this pull request Aug 14, 2026
…ules (#2913)

## What

Clears the last small batch of api ESLint warnings and promotes their rules to `error`.

| Rule | Count | Resolution |
|---|---|---|
| `@typescript-eslint/no-namespace` | 2 | Merge the duplicate Express `declare global` namespace blocks; scoped disable (pattern is required) |
| `@typescript-eslint/no-empty-object-type` | 1 | Scoped disable on `interface User extends UserDocument {}` (required for Express `User` augmentation) |
| `n/no-process-exit` | 5 | Config override: rule `off` for the two process entry-point files |

## Why

These are all **legitimate patterns the linter flags**, not real issues:

- **Express type augmentation** (`namespace Express { interface User … }`) is the documented way to extend Express's types — interface merging is required, and a type alias / non-empty interface can't do it. I merged the two duplicate `namespace Express` blocks into one for tidiness and disabled the two rules on that single augmentation block with an explanatory comment.
- **`process.exit()`** in `src/index.ts` (startup failure, last-resort `uncaughtException`/`unhandledRejection` handlers) and `src/tasks/index.ts` (CLI task completion/failure) is the intended behavior. Rather than 5 inline disables, the rule is scoped `off` for just those two entry-point files — so it still guards against stray `process.exit()` elsewhere in the api.

Promoting all three to `error` turns these into guardrails: new violations outside the sanctioned spots now fail lint. This is the last of the small mechanical/one-off batches (follows #2903, #2911, #2912).

## Verification

- `yarn lint` (api) — pass (0 errors; 3 rules now enforced as error)
- `tsc --noEmit` (api) — clean (Express augmentation still resolves after the merge)
- `yarn knip` — clean
- api `--max-warnings` lowered **311 → 302**

Behavior is unchanged. Changeset included (`@hyperdx/api` patch).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automerge review/tier-2 Low risk — AI review + quick human skim

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants