chore: name useRef values with a Ref suffix and enforce via ESLint - #2912
Conversation
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 detectedLatest commit: b740c49 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
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 |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🔵 Tier 2 — Low RiskSmall, isolated change with no API route or data model modifications. Why this tier:
Review process: AI review + quick human skim (target: 5–15 min). Reviewer validates AI assessment and checks for domain-specific concerns. Stats
|
Deep Review✅ No critical issues found. This is a purely mechanical rename of 10
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 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 SummaryThe PR standardizes React ref variable names and enforces the convention through ESLint without changing runtime behavior.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| 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
E2E Test Results✅ All tests passed • 292 passed • 1 skipped • 843s
Tests ran across 4 shards in parallel. |
…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).
What
Renames the 10
useRefvalues flagged by@eslint-react/naming-convention/ref-nameto end inRef, then promotes the rule toerrorso the convention holds going forward.DOMPlayer.tsxwrapper,playerContainer,replayer,initialEvents,setLastEventTsLoaded→*RefDBEditTimeChartForm/EditTimeChartForm.tsxsubFormDirty,autoRunFired→*Refhooks/useMetadata.tsxsettingsApplied→settingsAppliedRefsessions.tslastAbortController→lastAbortControllerRefutils.tsobserver→observerInstanceRefWhy
Consistent
Refnaming makes ref values obvious at a glance. This is the next mechanical batch in the ongoing lint-warning cleanup (follows #2903 and #2911).Notes
utils.ts, the intersection-observer hook already had anobserverRefcallback ref, so theuseRefwas renamed toobserverInstanceRefto avoid a redeclaration collision (rather than the mechanicalobserverRef).DOMPlayer.tsx's diff is larger only becausereplayerhad 39 usages — all pure renames.styles.playerContainer(a CSS class) was deliberately left untouched.Enforcement
@eslint-react/naming-convention/ref-name→error--max-warningslowered 601 → 590Verification
yarn lint(app) — pass (0 errors; rule now enforced as error)tsc --noEmit(app) — cleanyarn knip— cleanyarn ci:unit— 174 suites / 2898 tests passBehavior is unchanged. Changeset included (
@hyperdx/apppatch).